On Friday, October 18, 2019 at 2:21:34 PM UTC+3, Richard Damon wrote: > On 10/18/19 4:35 AM, doganad...@gmail.com wrote: > > Here is my question: > > > > > > I am using the numpy.std formula to calculate the standart deviation. > > However, the result comes as a number in scientific notation. > > Therefore I am asking, How to convert a scientific notation to decimal > > number, and still keep the data format as float64 ? > > > > Or is there any workaround to get the initial standart deviation result as > > a decimal number? > > > > > > Here is my code: > > > > stdev=numpy.std(dataset) > > print(stdev) > > Result: 4.999999999999449e-05 > > > > > > print(stdev.dtype) > > Result: float64 > > > > > > Solutions such as this: > > > > stdev=format(stdev, '.10f') > > converts the data into a string object! which I don't want. > > > > > > Expected result: I am willing to have a result as a decimal number in a > > float64 format. > > > > System: (Python 3.7.4 running on Win10) > > > > > > Regards, > > The number itself isn't in scientific notation or a fixed point number, > but is a floating point number that is expressed internally as an > integer times a power of 2 (that is the basic representation format for > floating point). > > Scientific notation vs fixed point notation is purely an OUTPUT > configuration, not a function on how the number is stored (so in one > sense IS more closely linked to a string than the float itself). > > -- > Richard Damon
Hello Richard, You seem so right. But what will we do with those strings with 'e' in it? There are ways to present those in a 'normal' way with formatting. However, the result of those formatting turns them into str object and which limits you to do any further numerical things with them. Another thing which I have observed, while doing some experimental thing is that: >>> 0.0 0.0 >>> 0.1 0.1 >>> 0.01 0.01 >>> 0.001 0.001 >>> 0.0001 0.0001 >>> 0.00001 1e-05 Again another thing with 1e-05! instead of 0.00001 , Is there anything I can do about it? -- https://mail.python.org/mailman/listinfo/python-list