Re: Number of Decimal Places
Re: Number of Decimal Places
- Subject: Re: Number of Decimal Places
- From: Doug McNutt <email@hidden>
- Date: Mon, 22 Apr 2002 15:45:47 -0600
At 16:00 -0400 4/22/02, Goldfish wrote:
>
determine the number of decimal places of a "real" named x.
>
For instance, "1" would be 0, "1.1" would be 2, "1.11" would be 3, etc.
One has to be careful about meaning here. Reals are a binary kind of things - IEEE 64 bit doubles to be exact. Asking how many decimal digits there are is fraught with implications. For instance:
If you enter an exact decimal number like 0.1000 and it is converted to a real you get a repeating binary fraction like:
0.0001001100110011001. . .
which never terminates. Well, It actually terminates when it runs out of the 52 bits allowed for its storage. It's like trying to represent 1/3 in decimal = 0.33333. . . which can never be exact.
You probably mean that you want to display a set number of decimal digits regardless of the "actual" number of digits actually stored. That's an format request rather than a measurement of something that exists.
--
--> Taliban: Women should not be educated.
--> Christians: Science must not learn about human cloning.
--> Mars anyone?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.