[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

fixed point rappresentation

io_x

6/14/2011 6:30:00 AM

why is prefer the C float-double-long double
over the fixed point number rappresentation?



5 Answers

luserXtrog

6/14/2011 8:24:00 AM

0

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.

gwowen

6/14/2011 8:44:00 AM

0

On Jun 14, 7:30 am, "io_x" <a...@b.c.invalid> wrote:
> why is prefer the C float-double-long double
> over the fixed point number rappresentation?

A much much much much (much) wider range of representable values in a
fixed number of bits, with precision appropriate to magnitude (at the
cost of arithmetical speed).

io_x

6/16/2011 5:55:00 PM

0


"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?



Angel

6/16/2011 6:29:00 PM

0

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

John Doe

6/17/2011 2:50:00 PM

0

On Thu, 16 Jun 2011 19:54:40 +0200, io_x wrote:

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

Fixed-point has constant absolute error. Floating-point has (roughly)
constant relative error. Choose your poison.