gettingstarted
[Top] [All Lists]

Re: Turning off sci.notation?

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Turning off sci.notation?
From: Eirik Karlsen <eikarlse at online dot no>
Date: Wed, 27 Apr 2005 23:50:49 +0200
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <001a01c5484d$5dc2b410$1a974154 at newa8bavxwdlz0> <426FE352 dot C531A3DC at online dot no> <f75b94f571b903507a16a76324e094f9 at freaksw dot com> <426FEE77 dot C62D82BB at online dot no> <a0620072ebe95a306114f at [10 dot 10 dot 13 dot 4]> <426FF9F7 dot CE54D87 at online dot no> <a06200736be95b0f05411 at [10 dot 10 dot 13 dot 4]>
Yeah I knew it!  :o)

I guess Format isn't the right thing to use in my case where:
the number MUST be 5 digits, and
there MAY be a dp (unknown where), and
there MAY be a minus sign.

Format can do some of these, but not all 3 at the same time (as far as I
know).

If we had the fictional "Precision =5" then instead of my 'messy' code we
could simply use
data=Left(str(y),5)  ' (for positive numbers)
data=Left(str(y),6)  ' (for negative numbers)



"Joseph J. Strout" wrote:

> At 10:45 PM +0200 4/27/05, Eirik Karlsen wrote:
>
> >     y=99.9990000
> >     data=Format(y,"#####")
> >returns "100"
> >
> >     y=9.99990000
> >     data=Format(y,"#####")
> >returns "10"
> >
> >     y=9999.90000
> >     data=Format(y,"#####")
> >returns "10000"
> >
> >
> >As one of the RB team I'm sure you'll have a good and perfectly
> >logic explanation to why this happens...
>
> Yes: Format is doing exactly what you've told it to.  The whole point
> of the Format function is that you can tell it what format you want;
> if you tell it "#####" (or the equivalent, "#"), then you're telling
> it that you WANT the number displayed as the closest integer, without
> a sign.
>
> If you want a number displayed as an integer, but with a sign, use
> "-#" as your format string.
>
> If you want it displayed as a decimal, with as many digits as needed
> to the right of the decimal point, use "-#.#".
>
> If you want a fixed number of places to the right of the decimal
> point, say five of them, then you might use "-0.00000".
>
> In short, tell Format what format you want -- if you give it an
> integer format, don't be surprised that it displays things exactly as
> you asked!
>
> Best,
> - Joe
>
> P.S. See the Language Reference for more details and examples of the
> format specifiers.
> --
> ,------------------------------------------------------------------.
> |    Joseph J. Strout           REAL Software, Inc.                |
> |    joe at realsoftware dot com       http://www.realsoftware.com        |
> `------------------------------------------------------------------'
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen


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

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

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