• 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: Scientific notation to text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scientific notation to text


  • Subject: Re: Scientific notation to text
  • From: Paul Berkowitz <email@hidden>
  • Date: Mon, 14 May 2001 00:14:30 -0700

On 5/13/01 11:55 PM, "Michelle Steiner" <email@hidden> wrote:

> On 5/13/01 10:21 PM, Paul Berkowitz <email@hidden> wrote:
>
>> Now try just compiling (don't run it yet):
>>
>> 1.94055698299304
>>
>> It compiles to:
>>
>> 1.940556982993
>>
>> so it looks as if those final '04' digits put it out of the reach of
>> AppleScript reals. That's what's happening when your typing is evaluated
>> before the 'as text' coercion even takes place. I know that the final two
>> digits don't disappear when you tack on 'E-4' and then compile or run the
>> resulting number, but I bet that they would get ignored in a calculation.
>
> Enter this into the script editor.
>
> 1.94055698299304 = 1.940556982993
>
> Compile it; it now displays this:
>
> 1.940556982993 = 1.940556982993
>
> Run it.
>
> --> false
>
We've been here before, a few months ago. It has to do with the binary
representation of some decimal numbers as not exact. So the above "equation"
will represent two different binaries which do not equal each other but
which both round to the same decimal real. I don't know why, in that case,
the longer number is truncated in decimal version - I'd guess because there
are too many significant places to represent accurately in binary.

--
Paul Berkowitz


  • Follow-Ups:
    • Re: Scientific notation to text
      • From: Paul Skinner <email@hidden>
References: 
 >Re: Scientific notation to text (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Scientific notation to text
  • Next by Date: Setting filename of files and in subfolders
  • Previous by thread: Re: Scientific notation to text
  • Next by thread: Re: Scientific notation to text
  • Index(es):
    • Date
    • Thread