Re: [Quickfix-developers] Possible Rounding Errors
Brought to you by:
orenmnero
From: Oren M. <or...@qu...> - 2004-04-27 20:08:29
|
Here is what the FIX spec says: float: Sequence of digits with optional decimal point and sign=20 character (ASCII characters "", "0" - "9" and "."); the absence of the=20= decimal point within the string will be interpreted as the float=20 representation of an integer value. All float fields must accommodate=20= up to fifteen significant digits. The number of decimal places used=20 should be a factor of business/market needs and mutual agreement=20 between counterparties. Note that float values may contain leading=20 zeros (e.g. =9300023.23=94 =3D =9323.23=94) and may contain or omit = trailing=20 zeros after the decimal point (e.g. =9323.0=94 =3D =9323.0000=94 =3D = =9323=94 =3D=20 "23."). On Apr 27, 2004, at 2:57 PM, Jody Hagins wrote: > On Tue, 27 Apr 2004 14:28:40 -0500 > Oren Miller <or...@qu...> wrote: > >> Looking at this more closely, we have several tests that have = trailing >> >> zeros, and this works fine. It looks like there are just too many >> significant digits. Are they running on a 64 bit architecture? I >> think the only thing you can do right now is to change the type to a >> STRING in the data dictionary. The alternative is to comment out the >> validation code for doubles. > > I doubt a 64 bit architecture is to blame. More than likely, a > printf("%.15f"), or setting a large precision in an ostream, or > something similar. The code to process doubles could be a *little*=20 > more > understanding, by using the standard limits to truncate the value to=20= > the > number of digits that can be represented on that hardware. In the = case > of a double, I'd think that would be better than rejecting the value. > By definition, you can not throw around floating point values and=20 > expect > to get the exact same value on different machines. > > That said, is there anything in the FIX spec that dictates precision = of > price values to something like 6 or 8 decimal places? > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek > For a limited time only, get FREE Ground shipping on all orders of $35 > or more. Hurry up and shop folks, this offer expires April 30th! > http://www.thinkgeek.com/freeshipping/?cpg=3D12297 > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > |