There is an issue with 'Std. parseFloat'

There is an issue with ‘Std. parseFloat’

I want to always keep ‘2 decimal places’,
But ‘Std. parseFloat’ removed my other decimal point!
.
01
02

I have written a function that retains my 2 decimal points,

The conversion of ‘Std. parseFloat’ to numbers has removed decimals ..

function toFixed(num:Float):String {

		var rounded = Math.fround(num * 100) / 100;
		var str = Std.string(rounded);
		var parts = str.split(".");
		
		if (parts.length < 2) {
			return str + ".00";
		}
		while (parts[1].length < 2) {
			parts[1] += "0";
		}
		return parts[0] + "." + parts[1].substr(0, 2);
	}

.
Sorry, I’ve always been mistaken about the type.
.
Because I used to use ‘as3’, I often used ‘toFixed’ to keep 2 as a decimal point
.
But when I used ‘openfl’, I found that there was no built-in method to achieve my effect, so I have been seeking solutions
.

.
I just communicated with a friend who angrily told me that ‘toFixed’ returns a string type
.
Then I opened “flash” to verify, and the result was indeed the returned string. I always thought that “toFixed” returned a numeric type, but I’m sorry, I didn’t pay attention to the return type
.


02

04