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

  • Next message: Shelby: "How to set UDT as Public so that I can assess it anywhere?"
    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).


  • Next message: Shelby: "How to set UDT as Public so that I can assess it anywhere?"

    Relevant Pages

    • Re: floating point arithmetic
      ... It does have a section on floating ... Another (an oldie, but a goodie) that I always ... Another hint to the same effect is the section ...
      (comp.soft-sys.matlab)
    • Re: Why does this work?
      ... from single- to double precision, you will not get a different result. ... It is not common to offer 128 bit floating point on 64 bit processors. ... Keep asking until hardware companies take the hint. ...
      (comp.lang.fortran)

    Loading