NAME:
STRSCI (function)
PURPOSE:
Given a number, returns a string of that B
number in scientific notation format ( e.g. A x 10 )
CATEGORY:
String Utilities
CALLING SEQUENCE:
Result = STRSCI( DATA [,keywords] )
INPUTS:
DATA -> A floating point or integer number to be
converted into a power of 10.
KEYWORD PARAMETERS:
FORMAT -> The format specification used in the string
conversion for the mantissa (i.e. the
"A" of "A x 10^B"). Default is '(f12.2)'.
/POT_ONLY -> Will return only the "power of 10" part of the
string (i.e. the "10^B"). Default is to return
the entire string (e.g. "A x 10^B" )
/MANTISSA_ONLY -> return only mantissa of the string
/SHORT -> return 10^0 as '1' and 10^1 as '10'
/TRIM -> don't insert blanks (i.e. return Ax10^B)
OUTPUTS:
None
SUBROUTINES:
None
REQUIREMENTS:
None
NOTES:
This function does not "evaluate" the format statement thoroughly
which can result in somewhat quirky strings. Example:
print,strsci(-9.999) results in -10.0x10^0 instead of -1.0x10^1.
Need a better symbol than the 'x' for the multiplier...
EXAMPLE:
Result = STRSCI( 2000000, format='(i1)' )
print, result
; 6
; prints 2 x 10!u6!n, which gets plotted as 2 x 10
Result = STRSCI( -0.0001 )
print, result
; 4
; prints -1.00 x 10!u-4!n, which gets plotted as 1.00 x 10
Result = STRSCI( 0d0, format='(f13.8)' )
print, result
;
; prints, 0.00000000
MODIFICATION HISTORY:
bmy, 28 May 1998: VERSION 1.00 B
- now returns string of the form A x 10
mgs, 29 May 1998:
- bug fix: now allows negative numbers
- keyword MANTISSA_ONLY added
- default format changed to f12.2
bmy, 02 Jun 1998:
- renamed to STRSCI ("STRing SCIentific notation"),
mgs, 03 Jun 1998:
- added TRIM keyword
mgs, 22 Sep 1998:
- added SHORT keyword
- modified handling of TRIM keyword
mgs, 24 Sep 1998:
- bug fix with SHORT flag
bmy & mgs, 02 Jun 1999:
- now can handle DATA=0.0 correctly
- updated comments
mgs, 03 Jun 1999:
- can now also handle values lt 1 ;-)
- and doesn't choke on arrays