floattoformat
Cncjerry
Posts: 64
Can't get floatforformat to compile. The other Float String routines compile
I get an "expected a subroutine name" on the last line above no matter how I type it. The priors FloattoString and others compile. I checked the module and the routine is there.
Jerry
f1:=float32.FFloat(micros) ' micros is now floating f2:=float32.FFloat(1000000) fps:=float32.FDiv(f1,f2) pst.str(fs.floattostring(fps)) pst.Chars(pst#NL, 2) f2:=float32.FFloat(1) fps:=float32.FDiv(f2,fps) pst.str(fs.floattostring(fps)) pst.Chars(pst#NL, 2) pst.str(fs.FloatToFormat(100.0,8,2))
I get an "expected a subroutine name" on the last line above no matter how I type it. The priors FloattoString and others compile. I checked the module and the routine is there.
Jerry
Comments
I'm pretty sure you can get by without that method.
If you're just using basic arithmatic you don't really need floating point numbers. You just multiple by 1000 or some other number to retain precision. You can then use a method "DecPoint" (a forum search should turn it up) to display the number with a decimal point in the desired location.
I'm pretty sure I have a copy of the float to string object that uses floattoformat, I'll find it and post it here in a bit.
Here's the method using PST method calls:
If you had a variable "x" which held the value "123456" and you wanted this value displayed as "123.456", you call the above method with;
I get '****.**' for output so something is wrong.
I tried using integer math and couldn't get it to work.
I have a delta time number in clock ticks like 43385201. This gets divided by 80_000_000 to get seconds. 1 divided by seconds turns into feet per second and displayed to two decimal positions. I need to do all this within the rate of fire for the automatic weapon we are timing with the high end of 1,800 rounds per minute or 3 per second.
Thanks for the help,
Jerry