Re: Strange basic problem with comparision of two varialbes defined as double
From: Duane Bozarth (dp_bozarth_at_swko.dot.net)
Date: 05/16/04
- Previous message: Steve Muccione: "Re: Visual Studio 6 hangs/stalls -> reason found"
- In reply to: Duane Bozarth: "Re: Strange basic problem with comparision of two varialbes defined as double"
- Next in thread: RAJ: "Re: Strange basic problem with comparision of two varialbes defined as double"
- Reply: RAJ: "Re: Strange basic problem with comparision of two varialbes defined as double"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 16 May 2004 09:32:25 -0500
Duane Bozarth wrote:
>
...snip example of floating point comparison result...
> > This is giving a lot of problems in the actual code in my application. Any
> > help would be greatly accepted.
>
> http://docs.sun.com/source/806-3568/ncg_goldberg.html
>
> As a hint in the VB Immediate window...
>
> dblOne# = 41.99#
> dblTwo# = 31.49#
> ?dblOne#-dblTwo#
> 7.105427357601E-15
Sorry, of course the demo was <really> the following--I somehow didn't
copy the one step...
dblOne# = 41.99#
dblTwo# = 31.49#
dblTwo# = dblTwo# + 10.5#
?dblOne#-dblTwo#
7.105427357601E-15
And, hint 2--
<NEVER, EVER> compare two floating point values for <exact> equality
(unless you really, really mean it (and understand fully what that
means), of course).
- Previous message: Steve Muccione: "Re: Visual Studio 6 hangs/stalls -> reason found"
- In reply to: Duane Bozarth: "Re: Strange basic problem with comparision of two varialbes defined as double"
- Next in thread: RAJ: "Re: Strange basic problem with comparision of two varialbes defined as double"
- Reply: RAJ: "Re: Strange basic problem with comparision of two varialbes defined as double"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|