Re: %g and fpformat.sci()
[Sivakumar Bhaskarapanditha]
> How can I control the number of digits after the decimal point using the %g
> format specifier.
You cannot. See a C reference for details; in general, %g is required
to truncate trailing zeroes, and in %<m>.<n>g the <n> is the maximum
number of significant digits displayed (the total number both before
and after the decimal point).
If you need to preserve trailing zeroes, then you need to write code
to do that yourself, or use the %e format code (or maybe even %f).
For example,
>>> a = 1.234e-5
>>> print "%.6g" % a
1.234e-005
>>> print "%.60g" % a
1.234e-005
>>> print "%.6e" % a
1.234000e-005
>>> print "%.6f" % a
0.000012
.
Relevant Pages
- New LottoGenius version - comments please.
... limit an amount of numbers inside any decade. ... Final Digits: matching final digits (all digits count, ... control the low/high numbers ratio within a combination. ... Sums: range of sums (selected numbers within the combination ... (rec.gambling.lottery) - Re: How to let the cursor stay implace?
... InputMask because with it the user has to key in exactly 7 digits. ... > property of the control from this function, ... the validationtext will be displayed. ... (microsoft.public.access.modulesdaovba) - RE: erratic format result
... coding, which is same as I was usuing, as control source for the control on ... If zipcode is all 9 digits, and I use format 00000\-0000, then I get correct ... Format I showed it should work every time - like I said, ... (microsoft.public.access.modulesdaovba) - Re: Driving 16 7-Segment Displays
... I very much like the idea of using an Interrupt Service Routine to ... i/o's to control the 7-segment displays.I ... > to multiplex 16 digits without using significant bandwidth. ... > current, not the multiplex frequency. ... (sci.electronics.design) - Re: concatenate and parse merged field with text
... in the replace with control. ... Doug Robbins - Word MVP ... last 7 digits of that number with a "W" in front. ... derive the web access ID, we need to concatenate a "W" with the last 7 ... (microsoft.public.word.mailmerge.fields) |
|