From: Angus Dorbie (dorbie++at++sgi.com)
Date: 06/21/2001 06:50:16
I can't find any explicit guidance on this except "The exponent always
contains at least two digits"
hmm... not very specific.
Maybe you can use the * modifier to set the overall size, but I'm not
sure it'll work and I'll leave the testing to you :-). If I test it and
it doesn't work then I don't get to post this printf arcana.
My theory is that ("%*.2E", 8, value) will give 1.23E001 but ("%*.2E",
7, value) will give 1.23E01, this may not work, technically the field
size needn't be too big but the routine might assume it is because of
the padding on the exponent and simply ignore the direction.
It the above trickery doesn't work then it's back to basics, worst case
you can sprintf, then look for the 'E' char then scan as an integer and
reprint the remaining exponent back to the string as a formated integer
%.2d to give 2 chars with leading zeroes, finally outputting the whole
string with the obvious %s.
Cheers,ANgus.
Olivier BILLARD wrote:
>
> thank you
>
> > Read the man pages they tell you this
> I have done this and on several OS (irix6.5, Solaris and MSVC)
> >
> > but ("%.2E")
>
> this doesn't answer the question
> let say I have 12.234567
>
> %.2E will give 1.23E001
> %E will give 1.234567E001
>
> and I nedd 1.23 E 01
> I need TWO digits on the E01 (not 001) exponent
> I have to feed old hardware with this...
>
> Anyway, I will re write a fprintf function for the float.....
>
> O BILLARD - FRANCE - obillard++at++free.fr
> Private: La croix Rolland - 22300 ROSPEZ - 33 (0) 6 68 73 54 92
> Office: Airtria - ZA Aeroport - 22300 LANNION - 33 (0) 2 96 05 82 72
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
-- For Performer+OpenGL tutorials http://www.dorbie.com/"Whenever there is a conflict between human rights and property rights, human rights must prevail." --Abraham Lincoln
This archive was generated by hypermail 2b29 : Thu Jun 21 2001 - 06:48:28 PDT