Why doesn't the 'haxe' numeric variable even have the basic 'toFixed()'?

Why doesn’t the ‘haxe’ numeric variable even have the basic ‘toFixed()’?

In ‘as3 js ts’,’ toFixed() ‘can be used to preserve decimal points, but in’ haxe ‘, why is there no basic’ toFixed() 'provided

Because I used to use ‘toFixed()’ to preserve the decimal point
When I arrived at ‘haxe’, I suddenly realized that this method was not built-in

That might be worth asking in the Haxe Forum Instead.

1 Like

I am not sure toFixed is accurate but if at the end of a calculation you need precise number of decimal places there are likely lots of libs and solutions. For instance found this…https://stackoverflow.com/questions/23689001/how-to-reliably-format-a-floating-point-number-to-a-specified-number-of-decimal
Haxe is very flexible language, so if a feature is missing make a haxelib to solve your need or find an existing one.

1 Like

I am not sure toFixed is ideal as you accumulate errors, is it not better to work with the highest accuracy or build a lib for even better and then set precision only after calculations?

1 Like