On Fri, Oct 14, 2005 at 07:44:16AM +0200, [EMAIL PROTECTED] wrote: > I am in the early planning stage of an audio processing application and I > have come to the point of making the choice between floating point or fixed > point (signed 2's complement) processing. > What do you think is better, and why? Why does jack use floating point? Why > does AES use fixed point in most of their standards? > > I understand the technical difference between the formats, but... > I can't come to a conclussion. > The adavantages of floating point I see are: > - easier processing, specially amplification and mixing (multiplying by > fractions) > - more sse support, more packed array arithmetics > - relationship to voltage and SPL easier to understand. (1.0f vs. 2^31-1 > max. values) > > And its diadvantages compared to fixed point would be: > - generally slower, specially things like addition > - 30 bits of resolution for 32 bits of data in IEEE single-precision > (exponents larger than 0 not used for audio, neither are denormalized > numbers and redundant zeroes, infinities, etc), compared to the full 32 bits > of resolution of fixed point. > - non-linear saw-tooth-like precission (precission gets higher as mantissa > gets larger and then falls abruptly at the point the exponent is increased) > > I am sure I fail to see the more important points and would be thankful for > any comments. > > If it has been discussed on the list earlier, i am sorry to post it again. I > couldn't find it. > > Greetigs, Dimitri
Many people have reinforced floating point's advantage of dynamic range. However, there are some other things I think are worth mentioning: Although it used to be true that integer arithmetic was much faster than floating-point, this is hardly true anymore. This notion mostly comes from the first x86 cpus that had external x87 co-processors. It was a new thing at the time, and because it was an external unit, it was necessarily slower. Now that the x87 is part of every x86 chip, and everyone plays games and music, floating point performance on intel flavored hardware is quite fast. Beyond the x87, there are also SSE and 3DNow standards that add even better capabilities, although you will need a very good compiler (that is, not gcc) or some manual assembly to take full advantage of them. Also, while integer addition is somewhat simpler than float addition, float multiplication is simpler than integer multiplication, and *far* simpler than float division. The x87 uses an 80 bit floating point format internally, and truncates or rounds to 32 or 64 (80 can be done too, with non-standard C) bit formats when returning the result. However, it's likely one will be using SSE or 3DNow if speed is very important, which use double (64) or single (32) bit formats. The integer counterpart of SSE is MMX, which is included on pretty much everything since the pentium pro. Not only floats can benefit from vector operations.