Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

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

After reading the responses and dealing with a little downtime at work, I went through the code and finally pinpointed the problematic assignment at:

#The assignments are condensed test values for the following formula. my ($sx1, $sy1, $sm, $rx1, $ry1, $rm) = (1000, 1000, 1.5574077246549, +1000, 1000, 0.871447982724319); my $rsx = ($sy1 - $ry1 + $rm * $rx1 - $sm * $sx1) / ($rm - $sm);

Even though the values plugged into the formula come out to 1000, I guess that isn't the case with the floating numbers. Since I didn't want to bang my head on this forever I figured I can somewhat predict what numbers will be dumped out by the formula. My kludge is to compare the four known values with each other then jump the entire block of problematic code if they equal each other.

I can't believe this never occurred to me. I rarely mix whole integers with floats and this is the first time I've done any comparisons. In retrospect, this is something I should have remembered from my first year in course work. Such as never using a float value to control a loop. Should have puzzled this out on my own with the realization I was comparing a float to an integer.

Oh well, I'm not happy about the kludge, but I can live with it.


In reply to Re: When 1000 is less than 1000 by SavannahLion
in thread When 1000 is less than 1000 by SavannahLion

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 surveying the Monastery: (2)
As of 2024-04-20 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found