Re: [linux-audio-dev] Denormal numbers

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Denormal numbers
From: Simon Jenkins (sjenkins_AT_blueyonder.co.uk)
Date: Sat Aug 02 2003 - 16:25:26 EEST


Steve Harris wrote:

>On Fri, Aug 01, 2003 at 11:36:22 +0100, Simon Jenkins wrote:
>
>
>>There are some limitiations though:
>>
>>
>
>Those are all good points, but my concerns are that I dont think it
>actually does what its supposed to do :)
>
>It could be the pointer aliasing + optimisation thing thugh, I'l check it
>out.
>
>- Steve
>
>
>
The actual maths (checking whether the exponent field is zero) looks
perfect to
me apart from the minus zero quibble, so its got to be a language or
compiler
subtlety.

So far we've got:

Problem: Operator precedence in complex expressions
Symptom: Totally incorrect calculations in some circumstances
Fix: Extra pair of brackets

Problem: Pointer aliasing + optimisation
Symptom: Calculations correct, but denormals not flushed in some
circumstances
Fix: Cast to volatile unsigned int *
Note: After the fix the affected code runs slightly slower in
ordinary (non-denormal)
calculations because the compiler is no longer optimising away the checking.

Both of the above are working solutions to demonstrable problems. If it
still doesn't
work after they are applied then you could try -ffloat-store. The
compiler manual
says that programs which rely on the exact storage format of IEEE floats
should
use this option, but I am unable to break the macro in a way that this
fixes. (Possibly
because the macro only works on lvalues and -ffloat-store seems to be
concerned
with intermediate values that the compiler generates).

=== Alternatively: ===
I'm hoping to post some code in the next day or two which prevents denormal
values from being generated in the first place.

(I haven't been torturing FLUSH_TO_ZERO in isolation... I've got my own
code hanging by its feet in the cell next door :) )

Simon Jenkins
(Bristol, UK)


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sat Aug 02 2003 - 15:30:18 EEST