Thread View: comp.sys.next.programmer
1 messages
1 total messages
Started by Lars Peter Fischer
Tue, 03 Nov 1992 01:21
Re: cc problem and cure: comparison among doubles can produce wrong results
Author: Lars Peter Fischer
Date: Tue, 03 Nov 1992 01:21
Date: Tue, 03 Nov 1992 01:21
18 lines
1095 bytes
1095 bytes
[ Our news server has been badly broken, so I'm resending this. Sorry if you've seen it before. ] >>>>> "Brian" == Brian Willoughby (BrianW@SoundS.WA.com) Brian> double res = 0.0; // default indicating no argument was specified Brian> [...] Brian> if (res) // now I'm using: if (res != 0.0) *Never* use explicit comparison of floating point values using "=". You'll be hit by all kinds of rounding errors. Use "<=" and ">=" instead, i.e., test that the value is withing some interval. /Lars -- Lars Fischer, fischer@iesd.auc.dk | It takes an uncommon mind to think of CS Dept., Aalborg Univ., DENMARK. | these things. -- Calvin
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads