realbasic-nug
[Top] [All Lists]

Re: double to string????

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: double to string????
From: Joe Strout <joe@inspiringapps.com>
Date: Mon, 30 Jun 2008 13:18:06 -0600
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: <C48EF1BB.4EB29%markus_winter@online.de>
References: <C48EF1BB.4EB29%markus_winter@online.de>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
On Jun 30, 2008, at 12:25 PM, Markus Winter wrote:

v as double
v = 12345678901234567890.1234567890

EF1.text = Format(v,
"- #########################################################.################
######################################")

produces

12345678901234567168.

in the EditField - bug or "feature"?

I'd say a bug, but a harmless one: you've used far more "#"'s than you need. Only one on either side of the decimal is significant, since its meaning is "use as many digits here as you need."

And what can I do about it?

Write instead:

 EF1.text = Format(v, "-#.#")

which is equivalent but much shorter and clearer.

Oh, and I suspect that you've assigned a value to "v" which is not representable by a double -- looks like too many digits there, though I'm not sure.

Best,
- Joe

--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com




_______________________________________________
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>