1. Sequence question
- Posted by gwalters May 01, 2013
- 1188 views
I have been having round off issues which hint that the elements of a sequence whicb are real numbers only have an accurace of about 8 digits. I had thought they were 16 digits. Can someone comment on sequence elements which are numberic. Most of mine (a record) have a mixture of numbers and character strings.
2. Re: Sequence question
- Posted by mattlewis (admin) May 01, 2013
- 1182 views
I have been having round off issues which hint that the elements of a sequence whicb are real numbers only have an accurace of about 8 digits. I had thought they were 16 digits. Can someone comment on sequence elements which are numberic. Most of mine (a record) have a mixture of numbers and character strings.
Euphoria atoms are stored as 64-bit floating point numbers (often referred to as double precision floating point). They store values as binary, so anything that cannot be represented like that can suffer from rounding errors when you display them.
Matt
3. Re: Sequence question
- Posted by mindwalker May 01, 2013
- 1163 views
I ran into the problem you are talking about many years back. What Matt is telling you in his reply is true, but there is a gothcha.
I'm not completely remembering the details but the sequence contains the accuracy he indicates. But when you print the value or convert the value to text characters to place in a file the print/printf or something defaults you to 8 decimal points of accuracy (at least it did in version 3.0). There is a way to tell euphoria you want more accuracy, but I forget how.
4. Re: Sequence question
- Posted by petelomax May 01, 2013
- 1140 views
I'm not completely remembering the details but ... when you print the value or ... something defaults you to 8 decimal points of accuracy (at least it did in version 3.0). There is a way to tell euphoria you want more accuracy, but I forget how.
Sounds like you are thinking of
atom i i=2/3 ?i printf(1,"%f\n",i) printf(1,"%0.15f\n",i)
which displays
0.6666666667 0.666667 0.666666666666667
HTH, Pete