Bizarre error... hulp?

    Date: 07/05/05 (Web Development)    Keywords: database, asp, sql

    IIS 6 SQL 7.0 ASP VBScript

    Some simple math:
    0.55 + 0.02 -0.49

    Should equal 0.08 – correct?

    When I add up these values from the database (the rest are 0 value - there are only three fields that have value as above)

    totalAdjust = oRecordset("hisSunAdj") + oRecordset("hisMonAdj") + oRecordset("hisTueAdj") + oRecordset("hisWedAdj") + oRecordset("hisThuAdj") + oRecordset("hisFriAdj") + oRecordset("hisSatAdj") + oRecordset("his2SunAdj") + oRecordset("his2MonAdj") + oRecordset("his2TueAdj") + oRecordset("his2WedAdj") + oRecordset("his2ThuAdj") + oRecordset("his2FriAdj") + oRecordset("his2SatAdj")

    I get: 8.00000000000001E-02

    If I do this in code:

    response.write 0.55 + 0.02 -0.49

    I get: 8.00000000000001E-02

    THAT is the most bizarre part because I’m just outputting the calculation – it can’t possibly be anything in the code or database because I hard coded the math and came out with the same WRONG answer!!

    Just to double check that I cut and pasted the record from the database into Excel and Summed it in there, and sure enough, it gave me the (correct) 0.08 just as my calculator did.

    Any thoughts??

    Source: http://www.livejournal.com/community/webdev/217437.html

« Iframe and new window || Help! »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home