Re: Question about precision
From: Toon Moene (toon_at_moene.indiv.nluug.nl)
Date: 08/25/04
- Next message: James Giles: "Re: What do you prefer: real(8) or double precision and why?"
- Previous message: Håkan Lane: "Re: Allocate error 494"
- In reply to: Keith Refson - real email address in signature: "Re: Question about precision"
- Next in thread: Paul Van Delst: "Re: Question about precision"
- Reply: Paul Van Delst: "Re: Question about precision"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 25 Aug 2004 22:16:32 +0200
Keith Refson - real email address in signature wrote:
> Might I suggest a different approach. Your problem arises because
> your grid spacing of 0.1 cm^-1 has no exact representation in binary
> floating point. But the numerical value depends on the units
> and can be changed to suit. If your program used internal units of
> 0.1cm^-1 then the grid spacing would be 1.0 which *is* exactly representable.
> In fact you could use integers which would eliminate representation
> and rounding errors entirely.
May I endorse this principle - and indeed it is far more principled than
the example given here:
"Don't count using floating point numbers."
(I wish I had space in my signature for this - it's the most frequent
problem I have to point out to g77 bug reporters, co-workers and
other people).
-- Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290 Saturnushof 14, 3738 XG Maartensdijk, The Netherlands Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/
- Next message: James Giles: "Re: What do you prefer: real(8) or double precision and why?"
- Previous message: Håkan Lane: "Re: Allocate error 494"
- In reply to: Keith Refson - real email address in signature: "Re: Question about precision"
- Next in thread: Paul Van Delst: "Re: Question about precision"
- Reply: Paul Van Delst: "Re: Question about precision"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|