Shop OBEX P1 Docs P2 Docs Learn Events
Help with programming higher order math in bs2 — Parallax Forums

Help with programming higher order math in bs2

MRM RCModelsMRM RCModels Posts: 5
edited 2007-08-25 17:37 in BASIC Stamp
I'm not all that great with programming bs2 so I hope there is someone outhere that can help me translate this equation into bs2 language:

V(t) = A * (5*[noparse][[/noparse]Q/P+1]^(2/7) - 1] * T(P)/T) ^ (1/2)

I can tranlate most of it on my own, but don't know how to express exponents [noparse][[/noparse]x^(2/7)]·in bs2 language.·Would there·be a·function for this?

thanks,

Kelvin

Post Edited (MRM RCModels) : 8/25/2007 6:36:16 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-25 17:37
    You can't "translate" this equation into Stamp Basic mostly because the Stamps don't have floating point arithmetic. It's all 16-bit integer arithmetic. The ^ (1/2) can be done because that's a square root, but whether the result makes any sense depends on some analysis of what values you're trying to handle. Then ^ (2/7) possibly could be done using table lookup, but the same issue comes up ... do the results make any sense at all using integer arithmetic?

    It is possible to do fixed point arithmetic with the Stamps (like use the integer value 32000 to represent the value 32.000 and do all your arithmetic accordingly with 3 decimal places). Have a look at this website for various discussions of fixed point and multiple precision arithmetic on Stamps: http://www.emesystems.com.
Sign In or Register to comment.