Custom Query


Show under each result:

Results (124 - 126 of 3866)

Ticket Resolution Summary Owner Reporter
#3817 Fixed Double to Int64 type conversion - wrong results Jon AspirinJunkie

Following script:

$fN = 562949953421312.0
$iN = Int($fN, 2)
$iN2 = Number($iN, 2)

ConsoleWrite("$fN :" & $fN & " (" & VarGetType($fN) & ")" & @CRLF & _
	"$iN :" & $iN & " (" & VarGetType($iN) & ")" & @CRLF & _
	"$iN2:" & $iN2 & " (" & VarGetType($iN2) & ")" & @CRLF)


$fN :562949953421312 (Double) $iN :562949953421313 (Int64) $iN2:562949953421313 (Int64)

This applies to all integer numbers >= 249 stored as double.

The numbers themselves can be mapped completely and without rounding errors in IEEE 754 double precision.

The naive approach to implementing an Int() function would be a C-type cast ((long long) fValue)) or a C++-typecast (static_cast<long long>(fValue)). However, these do not exhibit the problem:

#include <iostream>

using namespace std;

int main()
    double f = 562949953421312.0;
    long long iInt1 = (long long)f;
    long long iInt2 = static_cast<long long>(f);

In old public source codes of AutoIt also the C-cast was used for the Int() function ((__int64)m_fValue in method n64Value in file variant_datatype.cpp). In the meantime, however, there has apparently been a change here.

#3816 Completed Improvement of the example in the help of the function _WinAPI_ReadDirectoryChanges Jpm domenic.laritz@…

The example in the help for the _WinAPI_ReadDirectoryChanges function contains the following line of code:

DirRemove($g_sPath, 1)

Since all "magic" numbers should be avoided if possible, the use of "$DIR_REMOVE" would be better than "1". But this then implies the inclusion of the file AutoItConstants.au3 (see also the documentation of the function DirRemove).

#3815 No Bug Remark in help regarding return value of _ArrayDelete is wrong anonymous

The "Remarks" section of the _ArrayDelete function contains the following text regarding the return value (see "[...] but the return value of the function (if successful) gives the new highest row index of the array." But this statement is not true. The return value is not the new highest row index, but the total number of rows. See also the following example.

#include <Array.au3>

Local $aArray[5] = [0, 1, 2, 3, 4]

ConsoleWrite("Number of array elements before deletion: " & UBound($aArray) & @CRLF)
ConsoleWrite("Return value of _ArrayDelete: " & _ArrayDelete($aArray, 2) & @CRLF)
ConsoleWrite("Number of array elements after deletion: " & UBound($aArray) & @CRLF)
Note: See TracQuery for help on using queries.