• 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: Raphael Sebbe <email@hidden>
  • Date: Tue, 25 May 2004 16:20:02 +0200

Ondra,

Of course an infinite set can't be expressed from a finite one (or, to be picky, it depends on what you mean by "express"), but I won't discuss Lebesgue theory here. Outside of its context, my sentence does not mean anything. I meant that any rational rate (by opposition to irrational) can be used with no lost using that method. Again, this is not true in the absolute. It should be something like

any regular, bounded-as-they-should-be-for-your-application, rational-(-not-irrational-) rate.

But this would make emails unnecessarily longer.

Raphael

On 25 May 2004, at 15:00, Ondra Cada wrote:

Raphael,

On 25.5.2004, at 14:30, Raphael Sebbe wrote:

Time = TimeValue / TimeScale
That way, any rational number can be used

Not really, for TimeValue and TimeScale are limited too. Since the
computer is a finite thing, whilst numbers (even integers) happen to be
inifinite, you just cannot express "any number" from anything (but a
finite subset, like an interval of integers). There's an infinite
number of rationals in any interval (of a non-trivial length).

That's also the final reason why *any* computer number type is
"flakey": any type, whatever way it is defined, can express only a
finite number of values. All the others--*much* more of them!, an aleph
zero of rationals or integers, an aleph one of reals--, therefore, have
to be either refused (normally done for those exceeding some range) or
rounded (normally done for those inside the range, which cannot be
expressed).

Back to the original question: this is, actually, computing 101:
floats/doubles and alike are fit to be used in sci algorithms, *not*
expressing things like money amounts, which need to be precise. For the
latter, things like NSDecimalNumber, or in plain C an integer with an
explicit scale, are to be used.
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.
_______________________________________________
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.


  • Follow-Ups:
    • Re: why are floats flakey?
      • From: Ondra Cada <email@hidden>
References: 
 >why are floats flakey? (From: justin webster <email@hidden>)
 >Re: why are floats flakey? (From: Raphael Sebbe <email@hidden>)
 >Re: why are floats flakey? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: why are floats flakey?
  • 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