• 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: float error...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: float error...


  • Subject: Re: float error...
  • From: Doug Wyatt <email@hidden>
  • Date: Mon, 25 Mar 2002 08:32:46 -0800

IEEE floats are base 2 numbers, so it's not possible to precisely represent all base 10 real numbers.

You could step by 0.01 if you modified your code to round instead of truncate when fetching a parameter value.

Doug


On Monday, March 25, 2002, at 07:51 , David DeHaven wrote:

Found an issue with volume control some of you should probably be aware of:

I was stepping the volume by 0.01 when using the keyboard to control volume. Well, when it hit 0.52 or 0.58, it would stop, for no apparent reason. Then I looked at the actual values: 0.53 and 0.59 do _not_ exist in the 32 bit floating point world. They are 0.529999971 and 0.589999974 respectively. Somewhere along the lines (either in the default AudioOutputUnit or in the driver itself), the last 7 digits are being cropped so the volume doesn't change (or at least the value returned from the AudioUnit doesn't change).

My solution was to step by 0.02 instead, which seems to work just fine.

-DrD-
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden http://www.sonosphere.com

"Better to look like an idiot than to be one."
-- dsw
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: float error...
      • From: David DeHaven <email@hidden>
References: 
 >float error... (From: David DeHaven <email@hidden>)

  • Prev by Date: float error...
  • Next by Date: Detecting dropouts?
  • Previous by thread: float error...
  • Next by thread: Re: float error...
  • Index(es):
    • Date
    • Thread