05-11-2009 04:28 AM
Hello i think that's a simple question. I've to convert a decimal number (such as 0,1 ) into an integer number such as 0.
What should i do? i tried with functions >> numeric >> conversions >> to long integers but i saw it has only integers as input.
05-11-2009 04:49 AM - edited 05-11-2009 04:53 AM
Not 100 percent sure what you wanted, so I've provided 3 alternatives.
I hope this helps.
05-11-2009 05:54 AM
One addition to method 1 James posted:
Round towards nearest integer has one "exception" common to most programming languages:
If the value of the input is midway between two integers (for example, 1.5 or 2.5), the function returns the nearest even integer (2).
hope this helps,
Norbert
05-11-2009 04:50 PM
Norbert B wrote:One addition to method 1 James posted:
Round towards nearest integer has one "exception" common to most programming languages:
If the value of the input is midway between two integers (for example, 1.5 or 2.5), the function returns the nearest even integer (2).
...Wow - you serious about this? I've absolutely never heard of that before - I'll admit I'm not that experienced with programming languages though. Why does it do this - isn't this functionality rather illogical? It certainly strikes me as odd, but then i don't know exactly how the computer works it out.
Could someone shed some light on this for me please.
05-11-2009 04:56 PM
James Mamakos wrote:...Wow - you serious about this? I've absolutely never heard of that before - I'll admit I'm not that experienced with programming languages though. Why does it do this - isn't this functionality rather illogical? It certainly strikes me as odd, but then i don't know exactly how the computer works it out.
Could someone shed some light on this for me please.
Here is an explanation why.
Chris M