git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Convert a scientific notation to decimal number, and still keeping the data format as float64


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
> disadvantages.

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.
-- 
Pieter van Oostrum <piet-l at vanoostrum.org>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]