Re: [AD] C++ fix math

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 13 August 2002 23:05, Eric Botcazou wrote:
> Why to use 'double' instead of 'float' ? ftofix() and fixtof() both
> use floats.

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...

> 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 :-) ).

> 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.

> And I think { return fix(radtofix(x)); } is better.

OK. Must have been a bit tired when I wrote that ;-)

Bye for now,
- -- 
Laurence Withers,  lwithers@xxxxxxxxxx
(GnuPG 04A646EA) http://www.lwithers.demon.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9WYnqUdhclgSmRuoRAjHaAJ42/t1GJWIKUcdna2+jzzCVHQYaCwCeJ/ho
J3d+AiYkpamfaM++TeJKeqU=
=hxuE
-----END PGP SIGNATURE-----



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