Casting floating point number into e-notation [message #4562] |
Thu, 08 June 1995 00:00 |
cavanaug
Messages: 18 Registered: December 1994
|
Junior Member |
|
|
Please, please, please somebody tell me what I'm doing wrong with
my attempt to cast a floating point value into e-notation (using
our old buddy IDL) :
IDL> a = 3.567
IDL> print, size(a)
0 4 1
IDL> print, a
3.56700
IDL> b = strtrim (a, 2)
IDL> print, size(b)
0 7 1
IDL> print, b
3.56700
IDL> print, format = '(e11.4)', a
3.5670e+00
IDL> print, format = '(e11.4)', b
3.5670e+00
IDL> c = 0.0
IDL> reads, format = '(e11.4)', a, c
IDL> print, size(c)
0 4 1
IDL> print, c
3.56700
IDL> reads, format = '(e11.4)', b, c
IDL> print, size(c)
0 4 1
IDL> print, c
3.56700
IDL> c = ''
IDL> reads, format = '(e11.4)', a, c
IDL> print, size(c)
0 7 1
IDL> print, c
3.5670000
IDL> reads, format = '(e11.4)', b, c
IDL> print, size(c)
0 7 1
IDL> print, c
3.5670000
The print command works as expected when given a format, but when reads is
used, the variable "c", afraid of being labelled as an e-type by his f-type
friends, refuses, with all his strength, to be cast into e-notation. Why?
Charles
--
Charles Cavanaugh | "Words are very unnecessary, they can only do harm"
cavanaug@ncar.ucar.edu | - Depeche Mode
NCAR Boulder, CO, USA | "Facts all come with points of view"
My opinions | - Talking Heads
|
|
|