Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why aren't fixed-point types included in C99?

Thankfully, the complex type modifier was introduced into C99 standard. What I don't understand is why it was decided to omit support for fixed point arithmetic (specifically, support fractional types like 1.15 {signed} or 0.32 {unsigned}) where these types are so fundamental to DSP programming?

Does GCC support these through an extension?

like image 771
ysap Avatar asked Mar 27 '12 04:03

ysap


People also ask

What is fixed-point data type?

A fixed-point data type is characterized by the word length in bits, the position of the binary point, and whether it is signed or unsigned. The position of the binary point is the means by which fixed-point values are scaled and interpreted.

Why do we use fixed-point representation?

In computers, fixed-point representation is a real data type for numbers. Fixed point representation can convert data into binary form, and then the data is processed, stored, and used by the computer. It has a fixed number of bits for the integral and fractional parts.

What is fixed-point in C?

Fixed-point math typically takes the form of a larger integer number, for instance 16 bits, where the most significant eight bits are the integer part and the least significant eight bits are the fractional part.

What do you mean by fixed-point and floating point representation?

In fixed point notation, there are a fixed number of digits after the decimal point, whereas floating point number allows for a varying number of digits after the decimal point. Fixed-Point Representation − This representation has fixed number of bits for integer part and for fractional part.


1 Answers

It's been discussed/proposed (e.g., in N938, N953) but those papers have only proposed it as extensions, not additions to the main standard. Those seem to have led to its inclusion in N1169, which is a draft of TR 18037 ("Extensions to support embedded processors"), but that isn't considered complete (and the draft doesn't seem to have been updated in quite a while).

My guess (though it's only a guess) is that work on it probably got dropped (at least temporarily) to concentrate on finishing C11. Whether work on it will resume now will probably depend on whether there are still people around who still care. Writing and submitting a paper based on those earlier ones that covers more detail, provides more supporting evidence, etc., might help to get it back in motion again (though I obviously can't guarantee anything).

like image 184
Jerry Coffin Avatar answered Oct 03 '22 13:10

Jerry Coffin