formatting exponential notation [message #47961] |
Fri, 10 March 2006 05:33  |
Steve.Morris@libero.i
Messages: 12 Registered: March 2006
|
Junior Member |
|
|
Hi all,
I need a quick advice on the way to write number in the exponent format
I want.
For example, I want the number printed on my screen in the following
form
-2.3435e-5
i.e. 4 digits after the point and as function of e-5
Any suggestion? I have tryed to use the format='(EX.X)' but without
much of a success .... :(
|
|
|
|
Re: formatting exponential notation [message #48036 is a reply to message #47961] |
Wed, 22 March 2006 18:17  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Steve.Morris@libero.it writes:
> I think there's a bug somewhere, but didn't get time to go through. For
> example 0.99 when approximated with 1 decimal digit is written 0.1
> rather than 1.0
Humm, indeed. But the bug didn't yield in the 20 minutes
I was able to devote to the problem. I'll have to get to
it later this week.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: formatting exponential notation [message #48046 is a reply to message #47961] |
Wed, 22 March 2006 06:35  |
Steve.Morris@libero.i
Messages: 12 Registered: March 2006
|
Junior Member |
|
|
I multyply the number by 1e5 and write with 4 decimal digits and works
like a charm :))))
I think there's a bug somewhere, but didn't get time to go through. For
example 0.99 when approximated with 1 decimal digit is written 0.1
rather than 1.0
|
|
|
Re: formatting exponential notation [message #48076 is a reply to message #47961] |
Mon, 20 March 2006 12:08  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Steve.Morris@libero.it writes:
> it looks like work very nicely in trimming the decimals, but can you
> also set the exponent format?
> Like, asking to have all numbers with e.g. 4 decimals and writted as
> function of e-5 ?
> so, if you have like 24.53214e-6 writte 2.4532e-5
You can do whatever you like. The code is available. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|