Convert a scientific notation to decimal number, and still keeping the data format as float64
On 10/21/19 4:36 PM, doganadres at gmail.com wrote:
> On Monday, October 21, 2019 at 4:09:23 PM UTC+3, Piet van Oostrum wrote:
>> Piet van Oostrum <piet-l at vanoostrum.org> writes:
>>> doganadres at gmail.com writes:
>>>> I dont know much about scala actually. I have just have tried to give
>>>> 0.0001 and it returned a presentation with an 'e' .whereas python takes
>>>> 0.0001 and gives 0.0001 . it made me think python is better in that
>>>> specific subject.
>>>> However, python though starts to give 'e' number when 5 decimals are
>>>> given as input. Although there can be systems around which are better in
>>>> this subject other things I can achieve in python overrides some
>>> Yes, I would say Python is more user-friendly in this particular
>>> example, although both outputs are correct. If I remember correctly,
>>> Python had an update in the area several years ago to make the output
>>> for floating-point numbers more user-friendly, (and at the same time
>>> maybe even more correct).
>>> But these are just choices of the implementers of the language, not
>>> characteristics of the language itself.
>> In Python 0.00001 => 1e-05, so it just chooses a different point to
>> switch from pure decimal to scientific notation.
>> Pieter van Oostrum <piet-l at vanoostrum.org>
>> WWW: http://piet.vanoostrum.org/
>> PGP key: [8DAE142BE17999C4]
> They ought to have a reason to make the program switch from pure decimal to scientific notation representation. I don't know that reason. Getting along with it.
The basic reason is readability. A number like 0.0000000000000001 is
obviously fairly hard to read a see exactly what the value is. A number
like 0.1 isn't. So somewhere you need to change from fixed point to
exponential notation. A common criteria is about when the fixed point
number takes more space to represent than the exponential. 1.2E-05 takes
7 characters, 0.000015 takes 8 so the exponential is shorter.
As an aside, I would be very leery of numbers like 0.00001 or 1e-05 as
they only show 1 significant digit, so unless I have good reason to
believe that they are exact numbers, I would have concern of them being
very imprecise, and possibly just noise.