-2

enter image description here

I’m studying about sys.maxsize .

As I know, sys.maxsize means largest “integer” value that py_ssize_t can store.

and I compared float(sys.maxsize) and sys.maxsize.

And I found there is difference between them which is point(.)

Even though I put sys.maxsize into float,

Doesn’t it has to be bigger than 9.22xxx?

Like float(922) is 922.0, Not 9.22

I want to know why float(sys.maxsize) gets smaller than sys.maxsize.

Thanks for the answers to my question, and hope you have a great day.

  • 1
    That is the scientific notation, see the e+18 at the end. – luk2302 Oct 09 '22 at 10:01
  • Does this answer your question? [Convert float to string in positional format (without scientific notation and false precision)](https://stackoverflow.com/questions/38847690/convert-float-to-string-in-positional-format-without-scientific-notation-and-fa) – luk2302 Oct 09 '22 at 10:03

1 Answers1

0

That point is caused by the fact that the __repr__ method of class float uses the scientific notation.

Do you see that e+18 at the end? It means the number is the floated-point-number multiplied for 10 at the power of 18.


If you don't want it to happen, simply avoid using float, or represent the float using numpy.format_float_positional.

FLAK-ZOSO
  • 3,873
  • 4
  • 8
  • 28