Forum > General

StrToFloat - formatted

<< < (11/11)

SymbolicFrank:

--- Quote from: J-G on June 27, 2022, 06:21:31 pm ---
--- Quote from: BrunoK on June 27, 2022, 06:07:12 pm ---
--- Quote from: PascalDragon on June 26, 2022, 11:01:02 pm ---... So 5.125 can only be approximated and the math system can't simply show 5.125, because what if you did try to use the number that 5.125 is approximated as?

--- End quote ---
Well, as a special case 5.125 is exactly stored in double as 0.640625 × (2 ^ 3)

--- End quote ---
My point was that using my test program, all three 'types' return an incorrect value -
Currency = 5.1248,
Double &
Extended =  5.12499999999999

--- End quote ---

The thing is, as soon as you start doing math to it, you get rounding errors. When you take a decimal number and convert that to binary, you're doing math to it. And the other way around, of course. It is exactly the same as with integer math, only the fractions (rounding errors) are a lot smaller.

If you don't want any rounding errors: use Planck units.

winni:

If you don't want any rounding errors:

Use an analogue computer, not a binary one.

PascalDragon:

--- Quote from: 440bx on June 27, 2022, 01:53:44 pm ---
--- Quote from: PascalDragon on June 27, 2022, 01:18:13 pm ---Don't underestimate fixed floating point. Depending on your use case they might be better. ;)

--- End quote ---
Did you mean fixed _decimal_ point ?

--- End quote ---

I meant fixed point types. But yeah, thank you for pointing that out... :-[

SymbolicFrank:

--- Quote from: winni on June 28, 2022, 12:52:09 pm ---
If you don't want any rounding errors:

Use an analogue computer, not a binary one.

--- End quote ---
That doesn't really make a difference. It's about resolution. Even if you have an ultimately exact analog computer, you have to feed it with starting values, and at the end you have to extract the answer. Analog-to-Decimal-converters don't have infinite precision. That's the whole point.

Even more so: that's also the main problem with quantum computers. Even if we ignore the fact, that they aren't real quantum computers until they can use quantum entanglement, which they can't, the output contains all the possible solutions at the same time. Every time you calculate and read it, each bit has the value of one of the possible solutions, within the error margins...

They would work better when analog, but unfortunately in quantum mechanics everything is an integer.

So, until they can synchronize turning the entangled particles into a wave function totally synchronously and resolve that perfectly into binary words, as many times as there are solutions, it is just noise.

So, even on that scale it's integers all the way down :D

PascalDragon:

--- Quote from: SymbolicFrank on July 03, 2022, 10:49:09 pm ---
--- Quote from: winni on June 28, 2022, 12:52:09 pm ---
If you don't want any rounding errors:

Use an analogue computer, not a binary one.

--- End quote ---
That doesn't really make a difference. It's about resolution. Even if you have an ultimately exact analog computer, you have to feed it with starting values, and at the end you have to extract the answer. Analog-to-Decimal-converters don't have infinite precision. That's the whole point.
--- End quote ---

But you wouldn't have the rounding errors during the computation which is a real issue (no pun intended) with floating point maths.

Navigation

[0] Message Index

[*] Previous page

Go to full version