realbasic-nug
[Top] [All Lists]

Re: Different behavior of Str(Double)? / Re: Floating point overflow

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Different behavior of Str(Double)? / Re: Floating point overflow
From: Michael Diehr <md03@xochi.com>
Date: Tue, 30 Sep 2008 08:08:04 -0700
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <0CA35735-C38B-4711-976F-09B836D5E577@inspiringapps.com>
References: <mailman.3643.1222365006.22874.realbasic-nug@lists.realsoftware.com> <D8B903FF324D454BA0300ABE6555093D1757A4@BASEL.rothsoft.local> <0CA35735-C38B-4711-976F-09B836D5E577@inspiringapps.com>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
On Sep 29, 2008, at 7:27 AM, Joe Strout wrote:

yes: because with 15 significant digits, the double gets represented more accurate in a string? (-> feature)

That's what you want, you could use the Variant->String conversion, or use Format with a spec like "-0.#". But as you point out, if you want a more "natural" representation with a reasonable number of significant digits, it's harder to get that yourself.


Word of warning : "-0.#" as a format spec gives different results than Str(), e.g.
  str(1.0) --> "1"
  format(1.0, "-0.#") --> "1."
note the trailing period.  This feature bit me once.  :)




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>