Re: sprintf() precision arbitrarily at six decimal places?

new topic     » goto parent     » topic index » view thread      » older message » newer message

https://www.exploringbinary.com/decimal-precision-of-binary-floating-point-numbers/ A float single-precision has a decimal "precision" of about six figures. A float double-precision gives you about fifteen figures.

Euphoria 1.0 ( era of 16-bit computers) suggests that the "six" figures of sprintf) was inspired by the hardware of the time.

The ten digits of sprint) in oE std/lib looks like someone just liked the number "ten". You can edit sprint) to have a different default.

It is easy to forget that a decimal value you are thinking about is converted to binary and then converted back to decimal. Not all values survive this round-trip.

The oE sprintf) will create fake digits for you; as many fake digits as you wish! This has to be described as a bug. The Phix sprintf) does not do this.

To have sprintf) return a "value in its entirety" is not realistic. It is wrong to believe that values in computer hardware are genuine and accurate values.

My reference to "slide-rule" accuracy refers to a time when you had to think about the values you were using; now computers just spit out lots of digits.

And ... what Pete says.

_tom

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu