Shop OBEX P1 Docs P2 Docs Learn Events
Converting an integer to a float — Parallax Forums

Converting an integer to a float

John_BJohn_B Posts: 16
edited 2009-08-17 12:23 in Propeller 1
Hi
Is it possible to type cast an integer to float?
I have 2 integer values returned from cogs which are then manipluated by the spin code, the result being a float.
Using the following as an example (that obviously doesn't work), how can it be made to work?

long a
long b
long c

a := 999999
b := 4321

c·:= fMath.fDiv(a,b)

Cheers
John

Comments

  • John_BJohn_B Posts: 16
    edited 2009-08-17 12:23
    Have found the answer -

    Using the integer to float method in the floatMath object.

    c := fMath.fDiv(fMath.fFloat(a), fMath.fFloat(b))
Sign In or Register to comment.