|Problems? Is your data what you think it is?|
Re: Converting to decimal elsifby Sherlock (Deacon)
|on Jul 26, 2001 at 01:17 UTC||Need Help??|
I think your logic is somewhat incorrect, nlafferty.
I haven't tested this, but it would appear that if $start_minute was, say 38, to begin with, you'd like to get the value .75, correct? The way your logic is set up, the first elsif will be true (38 >= 7.5), therefore $start_minute will be set to .25 and all logic ends. I doubt this is what you want.
One simple solution would be to change your code like so...
This should fix your problem. Now, if we look at the case where $start_minute is 38, none of these will be true until you get to the third elsif, which sets $start_minute to .75, which is, I believe, what you want.
Hopefully, this helps,
Update: Doing conversions using just less thans or greater thans as BikeNomad and HyperZonk have done will make your code simpler but, please note, if you do that, order matters! My suggestion would be to do it that way, though.
Skepticism is the source of knowledge as much as knowledge is the source of skepticism.