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:45:01 -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: <C48EFF86.4EB3A%markus_winter@online.de>
References: <C48EFF86.4EB3A%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 1:24 PM, Markus Winter wrote:

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

which is equivalent but much shorter and clearer.

Did that - same result

As it should be.

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.

I'm aware of precicion problems - however in the example it's not the
decimal points which are changed but the numbers BEFORE the decimal point go
missing!


I see your point now -- using the format spec you've given, you're asking it to display more digits than it actually has, but you might be expecting it to fill in with zeros or some such. That could be considered misleading, though, since those digits are NOT zeros -- they're just unknown. Of course it would be more correct than just truncating.

The proper way to display a number like that is to use exponential (scientific) notation, which lets you show the digits you actually have, regardless of the exponent. But you gave a format spec which doesn't allow that. Perhaps it should switch to scientific notation anyway, rather than give a result which is plainly incorrect.

It's hard to say what RB should do here; we've basically given it conflicting instructions. But I would agree that it could probably find some smarter way to handle it than what it's doing.

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>