Re: Yosemite decimal number conversion error
Re: Yosemite decimal number conversion error
- Subject: Re: Yosemite decimal number conversion error
- From: Shane Stanley <email@hidden>
- Date: Wed, 29 Oct 2014 14:44:18 +1100
On 29 Oct 2014, at 1:40 pm, Takaaki Naganoya <email@hidden> wrote:
I found an error with decimal number conversion from AppleScript's ‘real' into Cocoa's ‘float'. Is it well-known?
I'm not sure that it's strictly an error, but the problem seems to be that the return value has a different precision. Storing floating-point values in binary form nearly always involves some rounding.
If you need exact matching values, you could try this:
on numberFloatWith:aNum set theNum to current application's NSNumber's numberWithFloat:aNum return (theNum's descriptionWithLocale:(current application's NSLocale's systemLocale())) as real end numberFloatWith:
But that's going to be messy with lists.
I guess the question is: Where and how does it really matter?
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden