Shop OBEX P1 Docs P2 Docs Learn Events
Float32 tutorial — Parallax Forums

Float32 tutorial

Would someone point me to a tutorial on setting up a large equation in Float32? Just give me a starting point please.
Thanks
Aaron

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2020-12-09 17:53
    There is no tutorial on setting up a large equation in Float32. You might look for tutorials and books on setting up a large equation on a "Reverse Polish" (RPN) calculator like those made by HP. Once you've converted the equation to RPN form, it's relatively easy to convert that to a series of calls on the Float32 routines. Instead of the implicit stack of RPN, you'd provide the equivalent using an array of longs.

    1.0 / ( A + B )

    becomes

    stack[0] := 1.0
    stack[1] := A
    stack[2] := B
    stack[1] := FAdd(stack[1],stack[2])
    stack[0] := FDiv(stack[0],stack[1])

    This obviously can be simplified, but each of these transformations is simple and mechanical ... normally would be done by a compiler.
Sign In or Register to comment.