Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003

    Unanswered: easy question for thos with experience...

    here's my query.

    $result = mysql_query("SELECT SUM(DAY+NIGHT) AS TOTALTIME FROM MAIN", $db);
    $myrow = mysql_fetch_array($result);
    extract ($myrow);
    echo ("<br>$TOTALTIME<br>");

    In my database, Night = 1.2 and Day = 0.7

    The answer should come up as 1.9 right?
    I'm getting:


    The first couple of decimal points are always correct, but then i get a bunch of numbers in the back

    any clude why?

  2. #2
    Join Date
    Oct 2003


    Honahble Sahn say ...
    "Floating point number like pile of sand on the ground. Each time you pick one up and move it, you lose a little sand and pick up a little dirt."
    You are always going to find a certain amount of imprecision in any floating point calculation. (Even those performed by your trusty pocket calculator.)

    This includes: imprecision during the calculation; truncation that can occur when storing the value in memory areas of various sizes; errors that occur in translating your character input into binary; and errors which occur in translating the binary data to decimal characters for your viewing pleasure!

    It's normal. Every computer application, not just MySQL, exhibits this behavior.
    ChimneySweep(R): fast, automatic
    table repair at a click of the

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts