comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Force to print exponential to e-6
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Force to print exponential to e-6 [message #88045] Fri, 14 March 2014 06:19 Go to next message
aberte@gmail.com is currently offline  aberte@gmail.com
Messages: 8
Registered: December 2006
Junior Member
I have, say an array with three numbers:
[2e-5,2e-6,2e-7]

I would like to print them on screen like this
20.0e-6, 2.0e-6, 0.2e-6

so forcing the exponential to be -6.

I can't figure it out how to do it. I'm trying to use string(format='(e)', x) without success.

Thanks
Re: Force to print exponential to e-6 [message #88046 is a reply to message #88045] Fri, 14 March 2014 06:30 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Doppler writes:

> I have, say an array with three numbers:
> [2e-5,2e-6,2e-7]
>
> I would like to print them on screen like this
> 20.0e-6, 2.0e-6, 0.2e-6
>
> so forcing the exponential to be -6.
>
> I can't figure it out how to do it. I'm trying to use string(format='(e)', x) without success.

I think you will probably have to write some kind of tick formatting
function:

http://www.idlcoyote.com/tips/exponents.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Force to print exponential to e-6 [message #88047 is a reply to message #88045] Fri, 14 March 2014 06:41 Go to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Friday, 14 March 2014 14:19:55 UTC+1, Doppler wrote:
> I have, say an array with three numbers:
>
> [2e-5,2e-6,2e-7]
>
>
>
> I would like to print them on screen like this
>
> 20.0e-6, 2.0e-6, 0.2e-6
>
>
>
> so forcing the exponential to be -6.
>
>
>
> I can't figure it out how to do it. I'm trying to use string(format='(e)', x) without success.
>
>
>
> Thanks

Here is one (ugly and nongeneral) way to do it:

IDL> a = [2e-5,2e-6,2e-7]
IDL> print, a*1e6, format='(3(f0.1, "e-6, "))'
20.0e-6, 2.0e-6, 0.2e-6

--
Yngvar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Optimizing code for faster calculation
Next Topic: Need help with map projection conversion in IDL or ENVI

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:40:13 PDT 2025

Total time taken to generate the page: 0.00378 seconds