• 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: why are floats flakey?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why are floats flakey?


  • Subject: Re: why are floats flakey?
  • From: Darrin Cardani <email@hidden>
  • Date: Tue, 25 May 2004 09:12:25 -0500

At 8:53 PM -0700 5/24/04, justin webster <email@hidden> wrote:
why are floats inaccurate?
when can I use them with confidence and what can I use in their place
when I need absolute accuracy?

i'm trying to create a float with a value of 29.97 and I get 29.9699999
like this:
float myFloat = [myTextField floatValue]
where the text field contains the string "29.97df"

You have a bigger problem here, I'm guessing. In addition to the problems others have mentioned there's the issue that 29.97 is probably not the value you actually want. I assume you're working with the NTSC frame rate? If so, you want to use 30001/1001, as 29.97 is not quite the correct value and can lead to drift on longer movies.

Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: Avoiding == and = mixup in if statements
  • Next by Date: Re: why are floats flakey?
  • Previous by thread: Re: why are floats flakey?
  • Next by thread: Re: why are floats flakey?
  • Index(es):
    • Date
    • Thread