[SciPy-User] Single or double precision?

David Cournapeau cournape at gmail.com
Mon Oct 29 10:26:55 EDT 2012


On Mon, Oct 29, 2012 at 2:18 PM, Sturla Molden <sturla at molden.no> wrote:
> Sorry this might be a bit off-topic. But I'll ask on this list anyway:
>
> Given that a signal is sampled at 16 bits resolution (at an ADC), will
> it always be sufficient to store a filtered version at single precision?
> I.e. a float32 has a 23 bit mantissa, so the truncation error should be
> tiny compared to the digitization error from the 16 bits ADC. Or am I
> thinking wrongly about this? Usually I don't care and just use double
> precision everywhere. But I will save gigabytes of store space by using
> single precision here.

Lots of sound card can sample at a 24 bits precision (16 bits is a bit
limiting if you really care about audio quality). So at least for
music processing, the consensus is that it is almost always good
enough to have the full path to single precision, except for a few
special cases.

You need to be careful when doing non-linear, or time-variant
processing: even a simple IIR whose parameters change in time (i.e.
not LTI) can actually blow up since all the convergence properties
rely on the time invariant property. In practice, people will
up-sample to avoid those issues.

David



More information about the SciPy-User mailing list