[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fprintf, %e
From: |
Tom Holroyd (NIH/NIMH) [E] |
Subject: |
Re: fprintf, %e |
Date: |
Wed, 30 Aug 2006 16:31:40 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) |
The problem is with the underlying C library's conversion function, not Octave.
But you can do this (for positive exponents only):
x = 1.2345678910e+002;
ex = floor(log(x)/log(10));
y = x / 10**ex;
fprintf('%10.10f+%03d\n', y, ex)
=> 1.2345678910+002
Jakub Selesovsky wrote:
Hello,
I have a little problem with the fprintf function. For another processing
I need to have the results from octave in this form:
1.2345678910e+002
I am able to control the precision and the width of the column via
'%17.10e' but I don't know how to control the number of digits behind
letter 'e'. I am always getting the output with two digits (e+02) in
exponent, but I have to get three digits (e+002).
Than you for any help.
Jakub
--
Tom Holroyd, Ph.D.
We experience the world not as it is, but as we expect it to be.
- fprintf, %e, Jakub Selesovsky, 2006/08/30
- Re: fprintf, %e,
Tom Holroyd (NIH/NIMH) [E] <=