Shop OBEX P1 Docs P2 Docs Learn Events
Big Ugly Math Library — Parallax Forums

Big Ugly Math Library

M. K. BorriM. K. Borri Posts: 279
edited 2006-11-15 05:03 in Propeller 1
This is the result of further work on "dynamizing" Float32Full.

See the Float32 for full documentation on this, nothing of note has changed -- there's some more functions, most of which are useful for navigation. Note that most float operations will take about 100us longer than specified in the float32full pdf, because we need to "reload" a cog every time -- the advantage is
that we only need one cog instead of two, and this library can be shared among multiple objects. For example, if your program uses five cogs, the other three are available to do math. Just call DynamicMathLib as an object from your other objects. Essentially, if a cog is available it will be "conscripted" to do the operation requested, if not, there will either be a wait or the calling cog will default to floatmath and try to do the operation on its own. Complicated operations such as FDist are broken in steps for this, to see if a cog freed up mid-operation.

Note that since this effectively replaces floatmath, if you use floatstring it may be beneficial to call this rather than floatmath from there. Also, a lot of functions are fairly specific for use in navigation with GPS -- if you don't need them, just comment them out: I put them in their own section to make this easy.

I know this isn't the most efficient way to do it, but it's the easiest to use in case you have multiple objects that need to do float math.

I haven't really tested the FFunc with only one cog available, but it works OK with two (as per Float32Full).

EDIT: Some trig functions didn't work. See post below.


mkb

Post Edited (M. K. Borri) : 11/11/2006 11:35:38 PM GMT

Comments

  • M. K. BorriM. K. Borri Posts: 279
    edited 2006-11-11 23:35
    Sorry about that -- some stuff didn't want to work. Now fixed, download this instead [noparse]:)[/noparse]


    I know that some operations aren't done in the optimal way, please tell me if I can improve this!! I really don't know how useful something is without feedback.
  • M. K. BorriM. K. Borri Posts: 279
    edited 2006-11-14 11:28
    How do I put this in the object exchange?
  • Rich MRich M Posts: 33
    edited 2006-11-14 14:10
    Since I'm currently working on some objects that interface with a GPS - thanks for the routines! They'll come in handy.

    - Rich
  • M. K. BorriM. K. Borri Posts: 279
    edited 2006-11-15 05:03
    happy to help! Me too, obviously [noparse]:)[/noparse] I'm making an UAV.
Sign In or Register to comment.