[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Standard IEEE floating point arithmetic



PureBytes Links

Trading Reference Links

Thank you Tomasz, I stand corrected :-)


I also will bookmark your links as I am sure the question will surface again.


best regards,

herman


Monday, May 14, 2007, 2:13:24 PM, you wrote:


>

Herman,

 

This is NOT overflow ! 

 

Overflow in single precision number happens when number is greater than 3.4×1038

 

That is: 3800000000000000000000000000000000000000

 

This is the largest number that 32 bit standard IEEE can handle. 

Overflow would happen when number exeeded that.

 

The other thing is number of *significant digits*.

This is how many digits are actually 100% accurrate - that's 7+ digits.

 

MUST READ:

http://en.wikipedia.org/wiki/IEEE_754

 

What is significant digit:

http://en.wikipedia.org/wiki/Significant_digit

 

Users' Guide:

http://www.amibroker.com/guide/afl/afl_view.php?almostequal

 

BTW: IEEE 32 bit standard is a world-wide standard for floating point arithmetic

available in ALL computer languages (in C it is represented by 'float' type). 

What's more it is used in TradeStation, Wealth-Lab, Metastock and other trading apps

and you would get the same results there as well.


Best regards,

Tomasz Janeczko

amibroker.com

----- Original Message ----- 

From: Herman 

To: Mark H 

Cc: amibroker@xxxxxxxxxxxxxxx 

Sent: Monday, May 14, 2007 5:47 AM

Subject: Re: [amibroker] Amibroker calculation error


You are exceeding the digit limit for AmiBroker. Do a search for "precision", its been discussed many times but I have forgotten the details.. 7 digits is the limit I seem to recall.


AmiBroker doesn't have an overflow error msg.


herman


Monday, May 14, 2007, 11:06:47 AM, you wrote:


>

Herman:

 

My concern is not getting the date format right. There are many ways to do that.

I just need to understand why this simple calculation (add) can have error.

 

1070511 + 19000000 = 20070512 instead of 20070511.

 

My hope is that somebody (maybe TJ) can explain it to me.

This is something serious, because it affects my confidence level toward Amibroker as a whole.

 

Thanks,

 

- Mark

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Herman

Sent: Sunday, May 13, 2007 10:41 PM

To: Mark H

Subject: Re: [amibroker] Amibroker calculation error

 

Why not use this:

 

Filter = 1;

SetOption("NoDefaultcolumns",False);

DateNumber = ParamDate("Date",Now(1)); // To provice test DateNum

DateString = NumToStr(DateTimeConvert( 2, DateNumber),formatDateTime);

AddTextColumn(DateString, "DateNum");

Buy = 1;

 

herman

 

Monday, May 14, 2007, 10:23:37 AM, you wrote:

 

I am trying to convert a date number to a year+month+day number for better display.

It worked before, but for May 11, I got this error:

1070511 + 19000000 = 20070512 instead of 20070511.

Here is a piece of code to demonstrate this calculation error:

 

---------------------------------------------------------

filter = 1;

daten = StrFormat("%f", 1070511 + 19000000);

AddTextColumn(daten, "DateNum");

buy = 1;

---------------------------------------------------------

The column will display 20070512.00000, not 20070511 as you would expect.

I understand that in AFL, all numbers are in double type and integer is converted when used. However, this doesn’t seem to be a rounding error since the result is exactly 20070512.00000, not something like 20070511.71332.

 

I am using 4.90.5. 

Have anyone seen this before?

 

Thanks,

 

- Mark

 

 

 

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___