in reply to bug in Perl compilation?

Looks like your standard floating point inaccuracies to me. Try

$num1 = 12e-4; $num2 = 1.2e-3; printf("%.18g\n", $num1); printf("%.18g\n", $num2);

(Sorry, I can't call a scalar that's meant to hold a numeric value "string" anything)

Remember that something somewhere has to do the computation to turn that scientific notation into a real number and that any computation involving floating point numbers is sure to have precision problems.

Replies are listed 'Best First'.
Re^2: bug in Perl compilation?
by bkgallo (Initiate) on Dec 21, 2005 at 19:18 UTC
    duff,

    Here are the results of running your code.

    LINUX:

    0.00119999999999999989
    0.00120000000000000011
    HP-UX:
    0.0011999999999999999
    0.0011999999999999999
    WIN2K (with ActivePerl):
    0.0012
    0.0012

    Wow, how can the Linux system interpret the same number so differently? Something weird must be going on with whatever does the numerical conversion.

      Wow, how can the Linux system interpret the same number so differently?

      The difference between 0.00119999999999999989 and 0.00120000000000000011 isn't really that much, numerically. In fact, the difference is 0.00000000000000000022. I'm not sure if that really warrants a "wow".