• 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: 1.0000023E+5 to 100000.23 as text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1.0000023E+5 to 100000.23 as text?


  • Subject: Re: 1.0000023E+5 to 100000.23 as text?
  • From: Nigel Garvey <email@hidden>
  • Date: Mon, 11 Dec 2000 15:28:54 +0000

In my message of Monday, 11 December 2000 10:50:11, I wrote:

>Jason Bourque wrote on Sun, 10 Dec 2000 19:43:29 -0500:
>
>>Hello,
>>
>>How would you go about converting scientific notation into text.
>>
>>i.e.
>>
>>1.0000023E+5 to 100000.23
>
>I posted this number-to-text handler recently as part of another script.
>There are shorter, mathematical methods, but this is text based to avoid
>certain floating-point problems. It correctly interprets any number
>presented by AppleScript in scientific notation - and most others; but if
>the input number is one of the problem ones (such as 8439.29 or 8439.39,
>which AppleScript presents as 8439.290000000001 and 8439.389999999999
>respectively), the output will be a string representation of the
>inaccuracy. For a complete solution with unknown input, I'd recommend using
>it in conjunction with something like my truncate-to-string handler (also
>below) with an adequately large decimal-place setting of (say) 15.

I'm sorry, I've just discovered a horrible bug in the truncate-to-string
handler (it doesn't work with numbers between 0 and +/- 1) but I won't
have time to fix it for a few hours. I'll look at it again when I get
back.

NG


  • Prev by Date: How to hide an application?
  • Next by Date: RE: AS starting
  • Previous by thread: Re: 1.0000023E+5 to 100000.23 as text?
  • Next by thread: Re: 1.0000023E+5 to 100000.23 as text?
  • Index(es):
    • Date
    • Thread