Baffled by inconsistent calculation

Hi,

Lucee 4.4.3 Docker on Ubuntu 16.04.
I’m doing simple arithmatic/calculation below

<cfset v1 = "0.00360100">
<cfset v2 = v1 - 0.0001>
save/write #v2#" to a file.

Results:
0.00360100 - 0.0001
0.00350100 instead get
0.007202
1 run = incorrect

0.007202 -
0.0001

0.007102
2 run = correct

0.007102 -
0.0001

0.007002
3 run = correct

Any insight?
I noticed the 1st run the value is of 8 decimal while for both the 2nd run and 3rd run the value is of 6 decimal. So, I wonder if there’s some function that allows conversion of a value to “a length of 8”, which could be “one digital before dot and then six decimal” or “two digitsl before dot and then five decimal” and so on.

Thanks.

I’m not sure what answer you expect here, you know full well that 4.4 is ancient. No one is going to spend any time diagnosing this.

Have you tried on 5.3?

You may want to revisit your code because even the basic math doesn’t make sense. (Where did 7202 come from?) And why are you assigning v1 as a string? You’re just forcing type conversion.

1 Like

Ok, I’ll take into upgrade Lucee.
In the meantime, solved (my own coding oversight)
Thanks.