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

[amibroker] Re: Floating point precision (or lack thereof)



PureBytes Links

Trading Reference Links

FYI

TradeStation supports Double-Precision Floating Point Variables since
TradeStation 7.0.

http://www.tradestation.com/new/tradestation7.shtm

Whats's New in TradeStation 7.0

TradeStation EasyLanguage Enhancements:
	Support for Double-Precision Floating Point Variables
EasyLanguage allows for numeric value types to be specified as
integers, single floats, or double-precision floating point values
(doubles), resulting in a improved calculation performance by using
integers where floats have previously been used, in addition to
enhanced calculation precision through the use of doubles. The numeric
values that are impacted by this change are Variables, Inputs, Arrays
, Functions and Plots.


--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
> Hello,
> 
> Some reading:
> http://docs.sun.com/source/806-3568/ncg_goldberg.html
> 
> 1. Precision is 7 significant digits.
> 2. No PRICE information on ANY market is provided with greater accurracy
> than 7 digits.
> 3. Because of (2), all major software packages including
Tradestation, Metastock
> and others use 32 bit floating point IEEE standard and
> there are NO problems using it assuming that you code properly.
> 4. Round() function does not change anything because certain decimal
fractions
> (like 0.1) can not be represented as binary fraction (because 1/10
can not be
> expressed as finite sum of binary fractions 1/2, 1/4, 1/8, 1/16,
1/32, 1/64, 1/128, and so on ......)
> And all computers work with binary numbers only (except some ancient
machines that
> were using BCD codes).
> 
> This is as plain obvious fact like the fact that 1/3 can not be
represented
> as decimal fraction. And if you round 1/3 expressed in decimal system
> 0.333333333 to any number of places you won't get accurate result no
matter what.
> 
> Actually in EVERY encoding system (using any base) there are
fractions not
> representable by finite number of digits)
> 
> Sorry guys but this is elementary school math.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Graham" <kavemanperth@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Wednesday, August 24, 2005 8:54 AM
> Subject: Re: [amibroker] Floating point precision (or lack thereof)
> 
> 
> > Yes it caused problems getting charts like PF charts correct.
> > You can work around it by rounding up or down eg in you case
> > an example  Round(L*100)/100
> > or
> > Unless you absolutely need accuracy past 5 digits, don't.
> >
> >
> > On 8/24/05, giggollo99 <giggollo@xxxx> wrote:
> >> Hi all,
> >>
> >> When i display values in commentary window like High, Low etc, I'm
> >> seeing values which appear to be imprecise. For example, my
downloaded
> >> data contains a low of 38.78 for a particular bar, but when I display
> >> the value in Commentary window to 8 decimal places i get:
> >>
> >> L=38.77999878
> >>
> >> This causes problems in backtesting because if i code this condition
> >>
> >> IIF(L<38.78,X,Y)
> >>
> >> the code will yield X when in fact it should yield Y because the low
> >> is not less than 38.78 (it is exactly 38.78). This occurs simply
> >> because of the imprecise representation of the value in AB.
> >>
> >> Does anyone know how to get around this, and if its normal for the
> >> value to be imprecise in AB?
> >>
> >> Thanks a lot,
> >> g
> >>
> >>
> >>
> >>
> >>
> >>
> >> 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 other support material please check also:
> >> http://www.amibroker.com/support.html
> >>
> >>
> >> Yahoo! Groups Links
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> > -- 
> > Cheers
> > Graham
> > AB-Write >< Professional AFL Writing Service
> > Yes, I write AFL code to your requirements
> > http://e-wire.net.au/~eb_kavan/ab_write.htm
> >
> >
> >
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >





------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hchvlbo/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1124910636/A=2894350/R=0/SIG=10tj5mr8v/*http://www.globalgiving.com";>Make a difference. Find and fund world-changing projects at GlobalGiving</a>.</font>
--------------------------------------------------------------------~-> 

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 other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/