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

Re^2: Multiple Conditional Statements

by vsespb (Chaplain)
on Sep 11, 2013 at 11:55 UTC ( #1053475=note: print w/replies, xml ) Need Help??

in reply to Re: Multiple Conditional Statements
in thread Multiple Conditional Statements

the OP didn't specify if e.g. 05.0 is identical to 5 or not - probably yes
Well, OP specified "!=" operator in original post.
However, as shown below, sanitizing input
In general case, programmer cannot control if his data is numified or no. So I don't think it's really about "sanitizing".
floats might need normalisation using sprintf...
In general case, normalization for floats won't work well, example:
perl -e 'my ($a, $b) = (0.45000001, 0.4499999); print sprintf ("%0.1f +%0.1f %f", $a, $b, $a-$b )'
prints 0.5, 0.4 and 0.000000

My example Re: Multiple Conditional Statements can be fixed to work with floats (but I admit it's slow).
UPD: fixed float example

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053475]
[stevieb]: choroba my GPS home device is done, at least prototype v1 is. I'm just making sure all of my code does what it says now
[stevieb]: I test/prototype code on my Pi, then I migrate it over to Arduino when it's ready (if that's a better platform for what I'm doing). The whole RPi stuff was for learning at first, then it snowballed. I'm just trying to get my in-house CI...
[stevieb]: ...done, which obviously requires a specific hardware setup.
[stevieb]: I don't write tests for the lower-level distributions (ie. ICs, sensors etc) within those distributions, I have all tests in a master distribution which encompasess all of the sub-modules

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2017-06-25 22:58 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (572 votes). Check out past polls.