Shop OBEX P1 Docs P2 Docs Learn Events
float32full — Parallax Forums

float32full

pilot00pilot00 Posts: 30
edited 2009-04-12 18:33 in Propeller 1
I am at my first attempt in using this application to do some math.
Does this work like this??(after declaring it as an obj)

repeat
number:=debug.getdec
math.sin(number)
answer:=math.sin(number)*2
debug.dec(answer)
waitcnt(clkfreq/10+cnt)

I just at this time want to see the sine or cosine on the serial terminal
to see if I am doing this right to later encorporate it in my application.

Thanks to all.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-12 18:33
    Not quite. All arithmetic operations have to be done using function calls and numbers (other than floating point) have to be converted to floating point values.
    repeat
       number := math.ffloat(debug.getdec)
       answer := math.fmul(math.sin(number),2.0)
       debug.str(mathstr.FloatToString(answer))
       waitcnt(clkfreq/10 + cnt)
    


    Note: mathstr is the FloatString object from the Object Exchange. You'll have to change this object to use float32full. There's a comment at the beginning that shows the simple change involved.
Sign In or Register to comment.