Re: understanding floats
From: David Steuber (david_at_david-steuber.com)
Date: 09/28/04
- Next message: marco: "Re: Lisp benefits against other functional programming languages"
- Previous message: Frank Buss: "Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?"
- In reply to: Ron Garret: "Re: understanding floats"
- Next in thread: Pascal Bourguignon: "Re: understanding floats"
- Reply: Pascal Bourguignon: "Re: understanding floats"
- Reply: Julian Stecklina: "Re: understanding floats"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Sep 2004 12:39:29 -0400
Ron Garret <rNOSPAMon@flownet.com> writes:
> The basic problem is easy to understand: 0.1 (a.k.a. 1/10) is a
> repeating decimal when represented in base 2.
>
> It is possible (and actually makes an educational and very doable
> exercise) to write floating point math routines that represent numbers
> in base 10 which do not suffer from this problem. (Of course, there is
> an analogous problem for a base 10 representation when dealing with
> fractions that are infinitely repeating decimals in base 10, like 1/3,
> 1/7, etc.)
I seem to recall that the 80387 math coprocessor had BCD instructions
and represented BCD numbers in 80 bits. I also seem to recall the
Borland C++ 2.0 compiler supporting BCD arithmetic although I don't
recall the declerations you needed to use to make BCD numbers.
Babbage's difference machine used decimal numbers, IIRC.
Would we count in octal if we had no pinkies?
-- An ideal world is left as an excercise to the reader. --- Paul Graham, On Lisp 8.1
- Next message: marco: "Re: Lisp benefits against other functional programming languages"
- Previous message: Frank Buss: "Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?"
- In reply to: Ron Garret: "Re: understanding floats"
- Next in thread: Pascal Bourguignon: "Re: understanding floats"
- Reply: Pascal Bourguignon: "Re: understanding floats"
- Reply: Julian Stecklina: "Re: understanding floats"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|