Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Decimal numbers calculations done inconsistently: Odd behavior!

by Krambambuli (Curate)
on Mar 20, 2015 at 09:35 UTC ( [id://1120720]=note: print w/replies, xml ) Need Help??


in reply to Decimal numbers calculations done inconsistently: Odd behavior!

Since your decimals seem to always have exactly two fractional digits, it might suffice to "translate" everything into an 100x integer space. So you might write
($open, $high, $low, $close) = map { s/\.//; $_; } @arr[3, 4, 5, 6];
and forget about the *100 multipliers in the following code.

Of course, you'll have to add back the 'decimal dots' when outputting the results.

---
Krambambuli

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1120720]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-03-28 08:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found