Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I appreciate the idea, but... still confused. I've changed the code to the following:

my $tolerance = 1.0e-16; # Change this value based on observation if ($tolerance*abs($range_min + $change_min) < abs($range_min - $chang +e_min)) { print "$variable has different minimum value:\n"; print " Change list: $changes{$variable}{min} ($changes{$variable +}{sheet})\n"; print " Range file : $range_file{$variable}{min} ($range_file{$va +riable}{sheet})\n"; my $difference = $range_min - $change_min; printf " Difference : %0.24f\n", $difference; } if ($tolerance*abs($range_max + $change_max) < abs($range_max - $chang +e_max)) { print "$variable has different maximum value:\n"; print " Change list: $changes{$variable}{max} ($changes{$variable +}{sheet})\n"; print " Range file : $range_file{$variable}{max} ($range_file{$va +riable}{sheet})\n"; my $difference = $range_min - $change_min; printf " Difference : %0.24f\n", $difference; }

Only difference to what you posted is the printf rather than print. And that was because the difference being shown with print was zero. This change in the code eliminated differences for four of the seven variables, but three remain:

variable_c has different maximum value: Change list: 45142.388774415 (Intermediate Variables) Range file : 45142.388774415 (Intermediate Variables) Difference : -0.000000000000014210854715 variable_f has different maximum value: Change list: 181.019658002611 (Intermediate Variables) Range file : 181.019658002611 (Intermediate Variables) Difference : 0.000000000000000000000000 variable_g has different maximum value: Change list: 1.57615706403821 (Intermediate Variables) Range file : 1.57615706403821 (Intermediate Variables) Difference : 0.000000000000000000000000

Variable C makes some sort of sense. I mean, I'm still under the impression that if I assign 45142.388774415 directly to two different variables, they should both have the same floating point representation. But they don't, obviously.

But what the hork is up with the other two? It seems to me that if the tolerance is 1e-16, there should be some difference shown in 24 places in the floating point number.


In reply to Re^2: False positive on inequality comparison by Nkuvu
in thread False positive on inequality comparison by Nkuvu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-24 18:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found