IEEE floating point standard, was: big numbers

Hi there,

Does anyone knows why having variable
Date_corr_before=20160519;
in reality afl operates it as 20160518.
What is going on?

Your value has 8 digits.
Recommended reading here
http://www.amibroker.com/kb/2010/07/20/about-floating-point-arithmetic/

Another thing to keep in mind is that 32-bit floating point number has only 7 significant digits (those digits that carry meaning contributing to its precision). So in 123.4567 all digits are significant and accurate, but in 123.456789, last two digits (‘8’ and ‘9’) are not significant and subject to floating point rounding – see links below).

Use datenum values instead (as you can see it has max. 7 digits)

Date_corr_before = 1160519;// type datenum (as in DateNum() array)

Or use DateTime number

Date_corr_before = _DT( "2016-05-19" );// now value is type date/time (as in DateTime() array)
2 Likes