Hello,
I need to know the fraction of a float (or double). So I tried
and I tried:
This is what happens:
or this:
This is wrong (of course) and not accurate enough. Anyone an idea?
[edit]
Whoaah? What's this?
Just for a test I tried
Print 1.2 - 1.0
Print 1.2
output:
0.200000048
1.20000005
It looks like it's a rounding thing for the print-function, isn't it?
So, in that case, there is nothing wrong with the function. Whew!
I need to know the fraction of a float (or double). So I tried
Function fraction:Double(f:Double) Return f - Int(f) End Function
and I tried:
Function fraction:Double(f:Double) Return f - Floor(f) End Function
This is what happens:
print fraction(1.2) output > 0.20000004768371582
or this:
print fraction(1.93) output > 0.92999994754791260
This is wrong (of course) and not accurate enough. Anyone an idea?
[edit]
Whoaah? What's this?
Just for a test I tried
Print 1.2 - 1.0
Print 1.2
output:
0.200000048
1.20000005
It looks like it's a rounding thing for the print-function, isn't it?
So, in that case, there is nothing wrong with the function. Whew!