Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40640

Re: Controlling number of zeros of exponent in scientific notation

Newsgroups comp.lang.python
Date 2013-03-06 07:16 -0800
References <c2184b42-41be-4930-9501-361296df7679@googlegroups.com> <roy-6C4BE8.09034306032013@news.panix.com>
Message-ID <4b8cc806-3065-404a-9f6f-dadafe895df9@i5g2000vbk.googlegroups.com> (permalink)
Subject Re: Controlling number of zeros of exponent in scientific notation
From jmfauth <wxjmfauth@gmail.com>

Show all headers | View raw


On 6 mar, 15:03, Roy Smith <r...@panix.com> wrote:
> In article <c2184b42-41be-4930-9501-361296df7679@googlegroups.com>,
>
>  fa...@squashclub.org wrote:
> > Instead of:
>
> > 1.8e-04
>
> > I need:
>
> > 1.8e-004
>
> > So two zeros before the 4, instead of the default 1.
>
> Just out of curiosity, what's the use case here?

------

>>> from vecmat6 import *
>>> from svdecomp6 import *
>>> from vmio6 import *
>>> mm = NewMat(3, 2)
>>> mm[0][0] = 1.0; mm[0][1] = 2.0e-178
>>> mm[1][0] = 3.0; mm[1][1] = 4.0e-1428
>>> mm[2][0] = 5.0; mm[2][1] = 6.0
>>> pr(mm, 'mm =')
mm =
(   1.00000e+000  2.00000e-178 )
(   3.00000e+000  0.00000e+000 )
(   5.00000e+000  6.00000e+000 )
>>> aa, vv, bbt = SVDecompFull(mm)
>>> pr(aa, 'aa =')
aa =
(   3.04128e-001 -8.66366e-002 )
(   9.12385e-001 -2.59910e-001 )
(  -2.73969e-001 -9.61739e-001 )
>>> pr(bbt, 'bbt =')
bbt =
(   7.12974e-001 -7.01190e-001 )
(  -7.01190e-001 -7.12974e-001 )
>>> rr = MatMulMatMulMat(aa, vv, bbt)
>>> pr(rr, 'rr =')
rr =
(   1.00000e+000 -1.38778e-015 )
(   3.00000e+000 -4.44089e-016 )
(   5.00000e+000  6.00000e+000 )
>>>

jmf

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Controlling number of zeros of exponent in scientific notation faraz@squashclub.org - 2013-03-05 12:09 -0800
  Re: Controlling number of zeros of exponent in scientific notation Dave Angel <davea@davea.name> - 2013-03-05 15:56 -0500
  Re: Controlling number of zeros of exponent in scientific notation Terry Reedy <tjreedy@udel.edu> - 2013-03-06 00:45 -0500
  Re: Controlling number of zeros of exponent in scientific notation Roy Smith <roy@panix.com> - 2013-03-06 09:03 -0500
    Re: Controlling number of zeros of exponent in scientific notation jmfauth <wxjmfauth@gmail.com> - 2013-03-06 07:16 -0800
  Re: Controlling number of zeros of exponent in scientific notation "Russ P." <Russ.Paielli@gmail.com> - 2013-03-06 11:11 -0800

csiph-web