Re: Can someone please explain - real numbers



In message <8855l2lt9g8r5b68gt8i77l3nktgg9prrl@xxxxxxx>, Wed, 8 Nov 2006
21:49:16, John Dough <nobody@xxxxxxxxxxxxxxx> writes
On Wed, 08 Nov 2006 20:51:34 GMT, Chris Cheney
<XXChris.CheneyXX@xxxxxxxxx> wrote:


Note that, for example, the simple decimal fraction 0.1 is the recurring
binary fraction 0.0001100110011001100110011001100110 (0110 recurring) and
cannot therefore be stored precisely as a single/double/extended/real.

The FPU knows how to handle repeating fractions, regardless of their
base. The repeating portion is truncated (and rounded, if necessary)
at the last available digit of precision for any given float type. In
the case of "extended", the decimal portion terminates at the 18th
position.

I'm not sure what leads you to believe that 0.1 cannot be stored
precisely. Did you try it with code? I did...and it works fine.
I can store 0.1, and I get back 0.1
If you get back what you store, then by all accounts, it's precise.


Our real problem is that you are not intelligent enough to understand
the magnitude of your ignorance. You could try reading
<URL:http://www.merlyn.demon.co.uk/pas-real.htm> ff., but the prognosis
is poor.

Try and explain
const
x : double = 0.01 ;
y : double = 0.06 ;
z : double = 0.07 ;
begin writeln(x+y=z) end.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
For news:borland.*, use their server newsgroups.borland.com ; but first read
Guidelines <URL:http://www.borland.com/newsgroups/guide.html> ff. with care.
.



Relevant Pages

  • Re: Is there a bigger data type in c than the double one?
    ... >> working with long doubles? ... As every binary fraction has a ... >> finite decimal fraction representation, ... > great precision because of the extended precision module, ...
    (comp.lang.c)
  • Re: Can someone please explain - real numbers
    ... recurring binary fraction 0.0001100110011001100110011001100110 (0110 ... at the last available digit of precision for any given float type. ... the decimal portion terminates at the 18th ... If you get back what you store, then by all accounts, it's precise. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Can someone please explain - real numbers
    ... binary fraction 0.0001100110011001100110011001100110 and ... The FPU knows how to handle repeating fractions, ... at the last available digit of precision for any given float type. ... inaccurate due to rounding errors. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Can someone please explain - real numbers
    ... binary fraction 0.0001100110011001100110011001100110 and ... at the last available digit of precision for any given float type. ... the decimal portion terminates at the 18th ... If you get back what you store, then by all accounts, it's precise. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Sql Everywhere Date precision ?
    ... As I said, i can simply store the "long" value, the result will be the same. ... I understand your need for precision, but as a practical matter I'm not ... The date's ticks is: Ticks 632902822536718750 long ... know if there is any way to "raise" the precision of the datetime format. ...
    (microsoft.public.sqlserver.ce)