I have a number that comes from Sigmoid function like '1.108779411784206406864790428E-69' but it's naturally should be between 0-1. How can I represent it in that way? Thanks
Asked
Active
Viewed 113 times
-3
-
2Can you make this a [mcve] and explain exactly what your issue is? – SuperStormer Apr 03 '20 at 17:43
-
I have float typed 1.108779411784206406864790428E-69 number in Python. And this number comes from a sigmoid function which is always return a number between 0-1, but in my case it's printed like Scientific Notation. I want to change this to a number between 0-1. – Fatih Sezgin Apr 03 '20 at 17:47
-
2The float is already a number between 0-1; python just prints it in scientific notation. – SuperStormer Apr 03 '20 at 17:48
-
So how can I format this number so I can actually see that value is between 0 and 1 ? – Fatih Sezgin Apr 03 '20 at 17:49
-
https://stackoverflow.com/questions/658763/how-do-i-suppress-scientific-notation-in-python – SuperStormer Apr 03 '20 at 17:50
-
You *already can* see that the value is between 0 and 1. – Kelly Bundy Apr 03 '20 at 17:56
2 Answers
1
The number that you got is the scientific notation of this number: 0.0000000000000000000000000000000000000000000000000000000000000000000011087794117842064068647904281594
To get the number like that, you need to do this:
x = 1.108779411784206406864790428E-69
print("%.100f" % x)
"%.100f" is the string to format, where 100 is the number of floats you need to show.

Jose Esparza
- 292
- 1
- 8
1
You can use the format statement to print. The original value is a float. For the convenience of readability python prints in scientific notation since this is a very small number. You can print upto more decimal places.. I have printed upto 96 decimal places below.
>>> a=1.108779411784206406864790428E-69
>>> "{:.96f}".format(a)
'0.000000000000000000000000000000000000000000000000000000000000000000001108779411784206406864790428'
Hope this helps.

Nick Rogers
- 328
- 1
- 5
- 16