View Full Version : Big Ugly Math Library

M. K. Borri
11-10-2006, 06:05 AM
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.


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

M. K. Borri
11-12-2006, 06:35 AM
Sorry about that -- some stuff didn't want to work. Now fixed, download this instead :)

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. Borri
11-14-2006, 06:28 PM
How do I put this in the object exchange?

Rich M
11-14-2006, 09:10 PM
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. Borri
11-15-2006, 12:03 PM
happy to help! Me too, obviously :) I'm making an UAV.