Another Rookie Question - Display a float !?
nestor73
Posts: 33
Hi all,
before i'm pulling out my hair, i'm going to try and explain my problem here. I have a simple
number that needs te be show on my VGA display. It's a float value (in order 1,5..8,5) but
i cannot seem to find an easy way to display it correctly. Why is that ??
Running_time is a normal integer..
This does NOT give a correct result !
before i'm pulling out my hair, i'm going to try and explain my problem here. I have a simple
number that needs te be show on my VGA display. It's a float value (in order 1,5..8,5) but
i cannot seem to find an easy way to display it correctly. Why is that ??
TurnsH:=(running_time/3) TurnsHF:=(running_time//3) tmp.displayString(strings.integertodecimal(TurnsH,2), tmp#white, tmp#blue, 20, 27 ) tmp.displayString(strings.integertodecimal(TurnsHF,1), tmp#white, tmp#blue, 20, 31 ) tmp.displayString(string(","), tmp#white, tmp#blue, 20, 30 )
Running_time is a normal integer..
This does NOT give a correct result !
Comments
guess i've tried all that there is to find in the OBEX. It just blows me away that an easy task like this (get a string out of a float) does not
work properly...
Ive also used the float_string , float_math, simple_numbers functions all without succes
and FloatString to display them. That works really well now ! Thanx !
cfloatstr.spin is attached below. Note, there is line containing "repeat -exp10" that doesn't compile under older versions of BST. You can change this to "repeat 0-exp10" to get it to compile, or use the latest version of BST. Also, cfloatstr.spin doesn't require any additional floating point objects if you are only using it to print, and are not actually doing any floating point math.