How to set the string of float value which are the same precision?
kevinspace
Posts: 56
Hello everyone~
I used the FloatString Object to display the float value, just like the code :
2
K: 3.333333
My question is that how to display the 2.000000 and K: 3.333333, In other words, I hope all the string of float value which are the same precision.
Are there any example or any suggesstion?
Thanks a lot.
QuestionOfFloat.rar
I used the FloatString Object to display the float value, just like the code :
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ Debug: "FullDuplexSerialPlus" FMath : "F32" FString : "FloatString" VAR long A, B, C, D, E PUB Operate FMath.Start Debug.start(31, 30, 0, 9600) Debug.tx(16) A := FMath.FFloat(10) B := FMath.FFloat(5) C := FMath.FFloat(3) D := FMath.FDiv(A, B) E := FMath.FDiv(A, C) repeat Debug.str(string("D: ", 13)) Debug.str(fstring.FloatToString(D)) Debug.str(string(13)) Debug.str(string("E: ", 13)) Debug.str(fstring.FloatToString(E)) Debug.str(string(13)) waitcnt(clkfreq*3 + cnt)The result of the Parallax Serial Terminal
2
K: 3.333333
My question is that how to display the 2.000000 and K: 3.333333, In other words, I hope all the string of float value which are the same precision.
Are there any example or any suggesstion?
Thanks a lot.
QuestionOfFloat.rar
Comments