Shop OBEX P1 Docs P2 Docs Learn Events
What happened? — Parallax Forums

What happened?

halfblinddadohalfblinddado Posts: 59
edited 2012-12-25 10:33 in Propeller 1
I was doing some floating point calculations and getting the results I expected then it started giving me strange results and then all zero's?

Is it maybe a harware problem?

[
x1 := 10.0
y1 := 10.0
x2 := 10.0
y2 := 10.0
lfy := f32.Fsub(x1, x2)
lfx := f32.Fsub(y1, y2)
z := f32.atan2(lfy, lfx)
Term.str(FS.FloatToString(lfx))
Term.str(String(13))
Term.str(FS.FloatToString(lfy))
Term.str(String(13))
Term.str(FS.FloatToString(z))
Term.str(String(13))
]

Comments

  • halfblinddadohalfblinddado Posts: 59
    edited 2012-12-25 10:09
    Ok so I changed x1 ... to all 10.0 Duh. I'm tired
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-25 10:33
    So this is working correctly?

    BTW, depending on which serial driver you're using the following:
    Term.str(String(13))
    

    Could be written:
    Term.tx(13)
    

    or if you're using PST:
    Term.Char(13)
    

    Another BTW, when posting code, it's a lot easier for us to read it if you use code tags. Here's a link to a tutorial.

    attachment.php?attachmentid=78421&d=1297987572
Sign In or Register to comment.