Re: Can someone please explain - real numbers
- From: Dr J R Stockton <jrs@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 9 Nov 2006 20:33:28 +0000
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.
.
- Follow-Ups:
- Re: Can someone please explain - real numbers
- From: John Dough
- Re: Can someone please explain - real numbers
- References:
- Can someone please explain - real numbers
- From: Paul W
- Re: Can someone please explain - real numbers
- From: Paul W
- Re: Can someone please explain - real numbers
- From: Nicholas Sherlock
- Re: Can someone please explain - real numbers
- From: Paul W
- Re: Can someone please explain - real numbers
- From: John Dough
- Re: Can someone please explain - real numbers
- From: Chris Cheney
- Re: Can someone please explain - real numbers
- From: John Dough
- Can someone please explain - real numbers
- Prev by Date: Re: A simple Rave report - but only produces one page
- Next by Date: Re: What about this solution ?
- Previous by thread: Re: Can someone please explain - real numbers
- Next by thread: Re: Can someone please explain - real numbers
- Index(es):
Relevant Pages
|