• 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: Sun, 13 May 2001 22:21:53 -0700

On 5/13/01 9:56 PM, "Paul Skinner" <email@hidden> wrote:

> I'm working on a handler for converting numbers in scientific notation
> to the non- notated version as text and it's all good. But...
>
> set theNumber to 1.94055698299304E-4
> set the theNumber to thenumber as text
> -->"1.940556982993E-4"
>
> This initial coercion causes a rounding at the twelfth decimal place. Is
> this appropriate behavior for AppleScript? It seems odd that a coercion to
> text would cause a math function to be performed on the argument.
> I don't know the internal handling of these classes well enough to know
> if I can work around this or not. Anyone have any ideas?


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.

Or maybe it's a bug of some sort.


--
Paul Berkowitz


References: 
 >Scientific notation to text (From: Paul Skinner <email@hidden>)

  • Prev by Date: Scientific notation to text
  • Next by Date: Re: Scientific notation to text
  • Previous by thread: Scientific notation to text
  • Next by thread: Re: Scientific notation to text
  • Index(es):
    • Date
    • Thread