• 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: "Numeric overflow"?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Numeric overflow"?


  • Subject: Re: "Numeric overflow"?
  • From: Jon Pugh <email@hidden>
  • Date: Thu, 15 Sep 2005 08:14:46 -0700

At 6:31 PM +0200 9/13/05, Emmanuel wrote:
>Pardon my stubbornness, Jon, but do you have an example of an unreasonably small number, Jon?

My flippant response is Plank's Constant:

	http://en.wikipedia.org/wiki/Plank's_constant

This is the size of a "quanta" which is the basic unit of quantum mechanics.  This constant is also used in the Heisenberg Uncertainty Principle.  It is approximately the smallest amount of energy one can measure in a given unit of time.

In practice, any number "sufficiently close to zero" can be unreasonable in a problem domain.  The determination of "unreasonable" is left to the implementor of the algorithm.

set N to 10000
set s1 to 0
repeat with i from 1 to N
	set s1 to s1 + i / N
end repeat
set s2 to 0
repeat with i from N to 1 by -1
	set s2 to s2 + i / N
end repeat
set diff to s2 - s1
set inv to 1 / diff
{s1, s2, diff, inv}

Results in:

{5000.499999999991, 5000.500000000002, 1.09139364212751E-11, 9.16259689813333E+10}

In this example, diff is the difference between summing from small to large and from large to small.  It is unreasonably small and functionally equivalent to zero.  The inverse of it, inv, is unreasonably large, given this program's purpose (which is largely to show how round off accumulates).

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

This email sent to email@hidden

References: 
 >Re: "Numeric overflow"? (From: Mr Tea <email@hidden>)
 >Re: "Numeric overflow"? (From: Jon Pugh <email@hidden>)
 >Re: "Numeric overflow"? (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Mount volume using a shell script
  • Next by Date: Re: "Numeric overflow"?
  • Previous by thread: Re: "Numeric overflow"?
  • Next by thread: Re: "Numeric overflow"?
  • Index(es):
    • Date
    • Thread