Angel
6/16/2011 6:29:00 PM
On 2011-06-16, io_x <a@b.c.invalid> wrote:
>
> "luser- -droog" <mijoryx@yahoo.com> ha scritto nel messaggio
> news:b8a85116-c1dd-4cee-b889-97db3b283c88@k24g2000yqb.googlegroups.com...
> On Jun 14, 1:30 am, "io_x" <a...@b.c.invalid> wrote:
>>> why is prefer the C float-double-long double
>>> over the fixed point number rappresentation?
>
>>It's preferred by most C-programmers because floating-point
>>operations are built in to the language. To use a fixed-point
>>representation you'd have to implement all the operations
>>as functions or macros.
>
> so the C float way is better, more precise, etc respect
> fixed point representation?
He didn't say that. Only that floating point is available by default and
fixed point is not, making floating point the most obvious choice for
most programmers. In most cases, the precision offered by float or
double is "good enough".
As a matter of fact, the Allegro game programming library used to work
with fixed point, but they have moved away from it because it was more
trouble than it's worth. Their words:
"Unfortunately the only advantage of fixed point math routines is that
you don't require a floating point coprocessor to use them. This was
great in the time period of i386 and i486 machines, but stopped being so
useful with the coming of the Pentium class of processors. From Pentium
onwards, CPUs have increased their strength in floating point
operations, equaling or even surpassing integer math performance."
--
"C provides a programmer with more than enough rope to hang himself.
C++ provides a firing squad, blindfold and last cigarette."
- seen in comp.lang.c