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



jep200404@example.com writes:
 > 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+

 > Fuss with using e, f, or g conversion code.

In JavaScript, I guess first parseFloat to get a floating point number
from the user's input (not sure what happens if a number is too big
for the precision available to floats, and I hope it handles
integers), then toExponential(n) where n is the precision you want
displayed.

This is my first ever attempt at designing a JavaScript program. ;-)

Google taught me everything I know about it ....

Steve



Home | Main Index | Thread Index