Re: [AD] C++ fix math

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Check out allegro/include/allegro/inline/fmaths.inl (the file I patched)
> - - both ftofix() and fixtof() use doubles. Since the definitions of
> fixtorad() and radtofix() are directly below these, I also used
> doubles...

Indeed. Really funny, because the docs say they use float :-)
Ok, which ones do we fix ?

> > Moreover, I think taking a look at the actual
> > implementation of fixmul() could be worth while...
>
> What do you mean? (And the only assembly I know is for 14-bit PICs, so
> that probably wouldn't help me :-) ).

I simply wonder whether it wouldn't be better (performance-wise) to let the
FPU do the multiplication instead of using the integer-based fixmul().

Bob, are you around there ? What do you think of the game i386 FPU's fmul()
vs algcc386.h's fixmul() ?

> > Simply rad(), no ? r = f.rad();
> > Why not from_rad() ? fix f = fix::from_rad(r);
>
> Those were the two names I originally came up with, but I felt it was
> clearer using fixtorad() and radtofix(), since (a)it makes it totally
> explicit what is going on, and (b)there is no real documentation for
> the 'fix' class; what little documentation there is would suggest using
> the C function names.

While I don't really agree with (a) (IMHO rad() and from_rad() are explicit
enough), I think you have a point with (b). So why not simply add a line for
these two functions in the docs ?

- Eric




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/