Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] big number calculation to small number using Python
- Date: Mon, 22 Mar 2021 20:14:54 -0400
- From: jep200404@example.com
- Subject: Re: [tlug] big number calculation to small number using Python
- References: <CAMyPCTSYgGyjrctN3P67KJ+9F76qRu_DSN7Q=F91Map3Pc3y7w@mail.gmail.com> <bb6b7debf4b4cc5fb6c559beff66d3ce@jp.sometwo.net> <CAMyPCTRAd6_yUsAwZmrQ+-H-L3tdFDWNjSs1CUN40ZgZZZ8T-A@mail.gmail.com>
On Mon, 22 Mar 2021 23:54:32 +0000, James Tobin <jamesbtobin@example.com> wrote: > rather than showing the true number i want to display to the user (on > the screen) the smaller (scientific notation) number, i.e. if the > input is 2222222222222222222222 display as xxxxe+ > the user is not constrained by how many digits they can key in which > is why i want to display the calculations (based on their input) using > smaller number equivalents j@j:~/jupyter$ echo 2222222222222222222222 | python3 -c 'x=float(input()); n_digits=3; print(f"{x:.{n_digits}g}")' 2.22e+21 j@j:~/jupyter$ Fuss with using e, f, or g conversion code.
- Follow-Ups:
- Re: [tlug] big number calculation to small number using Python
- From: Stephen J. Turnbull
- References:
- [tlug] big number calculation to small number using javascript
- From: James Tobin
- Re: [tlug] big number calculation to small number using javascript
- From: furkan
- Re: [tlug] big number calculation to small number using javascript
- From: James Tobin
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] big number calculation to small number using javascript
- Next by Date: Re: [tlug] big number calculation to small number using Python
- Previous by thread: Re: [tlug] big number calculation to small number using javascript
- Next by thread: Re: [tlug] big number calculation to small number using Python
- Index(es):