• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: long double data type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: long double data type


  • Subject: Re: long double data type
  • From: "Paul Sanders" <email@hidden>
  • Date: Mon, 14 Jun 2010 20:35:01 +0100

The floating point unit works at 80 bit precision on 32 bit Intel (and, I believe, 64 bit Intel) but when results are moved to memory (including, where necessary, temporaries) then the results are truncated to 64 bits.  SSE instructions exist to process both 32 single precision and 64 bit double precision values.  Single precision values are processed four at a time and double precision two at a time, so single precision is faster for this (but not much else).  I actually found that vectorising double-precision operations made little difference, but that might be because I don't know much about SSE and wasn't getting the best out of it.
 
The DSP I do (IIR filters, Fourier transforms, matrix manipulation and some other stuff) is mostly done in double precision because if you work in single precision the errors mount up, depending on the exact nature of the maths you are doing, even if the samples themselves are relatively low precision.
 
A 'hidden' factor influencing speed is that
 fewer double precision numbers fit in the CPU cache and for this reason I do my FFT's on single precision arrays, which speeds things up noticeably and seems to work pretty well.  OTOH matrix manipulation (specifically, matrix inversion) in single precision sometimes gives hopelessly unpredictable results so I had to give up on that idea.  Google numerical stability for some insight as to why.
 
I have no idea if any of what I just said is useful to anyone.  As Jens says, there are people who hang out on the core-audio list who know about this kind of stuff.  You might also want to visit dsprelated.com and possibly Hydrogen Audio.
 
Regards,
 
Paul Sanders.
 
 
----- Original Message -----
From: Jens Alfke
To: Luigi Castelli
Cc: email@hidden
Sent: Monday, June 14, 2010 7:17 PM
Subject: Re: long double data type


On Jun 14, 2010, at 10:58 AM, Luigi Castelli wrote:

> I am working on a DSP audio mastering application that needs to perform mathematical operation at very high resolution.

CoreAudio natively uses 32-bit floats (with 24-bit mantissa) to represent samples. I believe that resolution’s sufficient for even pro apps — Red Book [CD] audio is only 16 bits, and I don’t think even high-end formats use more than 24-bit.

I’m not an expert on FP math, but I don’t know of any float data type supported on Mac OS with more than 64 bits of precision (aka ‘double’).

> Is it a viable choice for a DSP audio application or will I regret it in the long run?

To my knowledge, the vector processing units on x86 only support 32-bit floats. So you wouldn’t be able to vectorize higher-resolution operations, greatly reducing performance. Definitely a consideration if you want to run in real-time.

You might want to ask on the coreaudio-api list, in case anyone has advice on what kind of numeric precision is needed for pro audio work.

—Jens
 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: long double data type
      • From: Jonas Maebe <email@hidden>
References: 
 >long double data type (From: Luigi Castelli <email@hidden>)
 >Re: long double data type (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: long double data type
  • Next by Date: Re: long double data type
  • Previous by thread: Re: long double data type
  • Next by thread: Re: long double data type
  • Index(es):
    • Date
    • Thread