Re: [AD] a fix struct for dallegro

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


On Monday 16 April 2007 04:23:35 pm Peter Wang wrote:
> The problem here is not float vs fixed but between different angle
> representations.

Which is inherent in float vs fixed. There's no standard math functions for 
floats that use binary angles, and there's no Allegro math functions for 
fixed types that use radians. Being able to just change variable types and 
add casts doesn't do much to make people aware of these difference though, 
IMO.

> Who says I don't want radians stored as fixed point 
> values?

No one, and there's nothing stopping you from doing so. But I'd think more 
often than not, that won't be the case. Besides which, you'd retain more 
precision by using binary angles with a fixed (16 bits + 8 = 24 bits needed, 
full range covered) as opposed to radians with a fixed (16 bits + 3 = 19 bits 
needed, full range not covered). Plus it's more efficient to use fixed point 
math with binary angles than radians.

That as opposed to using radians with a float, where the smaller whole number 
would give way to increased decimal precision, and the FPU having op codes 
using radians (AFAIK).




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