Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
February 17, 2015 BigFloat? | ||||
---|---|---|---|---|
| ||||
We've got arbitrary precision integers, why not arbitrary precision floating point? |
February 17, 2015 Re: BigFloat? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vlad Levenfeld | Periodic fractions. |
February 17, 2015 Re: BigFloat? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Tuesday, 17 February 2015 at 08:05:49 UTC, Kagamin wrote:
> Periodic fractions.
Or transcendental numbers, for that matter, but arbitrary != infinite. A max_expansion template parameter could be useful here.
For my use case I'm less concerned with absolute resolution than with preserving the information in the smaller operand when dealing with large magnitude differences.
|
February 17, 2015 Re: BigFloat? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vlad Levenfeld | On Tuesday, 17 February 2015 at 09:08:17 UTC, Vlad Levenfeld wrote:
> On Tuesday, 17 February 2015 at 08:05:49 UTC, Kagamin wrote:
>> Periodic fractions.
>
> Or transcendental numbers, for that matter, but arbitrary != infinite. A max_expansion template parameter could be useful here.
>
> For my use case I'm less concerned with absolute resolution than with preserving the information in the smaller operand when dealing with large magnitude differences.
We have rational (two bigint, one for the numerator and one for the denominator), which I like better than floatingpoint (it's more expressive).
|
February 17, 2015 Re: BigFloat? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vlad Levenfeld | On Tuesday, 17 February 2015 at 09:08:17 UTC, Vlad Levenfeld wrote:
> For my use case I'm less concerned with absolute resolution than with preserving the information in the smaller operand when dealing with large magnitude differences.
What do you mean? As long as you don't change the operand, it will preserve its value.
|
February 17, 2015 Re: BigFloat? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Tuesday, 17 February 2015 at 14:03:45 UTC, Kagamin wrote: > On Tuesday, 17 February 2015 at 09:08:17 UTC, Vlad Levenfeld wrote: >> For my use case I'm less concerned with absolute resolution than with preserving the information in the smaller operand when dealing with large magnitude differences. > > What do you mean? As long as you don't change the operand, it will preserve its value. If you add or subtract two floating point numbers whose magnitudes differ, then the lower bits of the smaller operand will be lost in the result. If the magnitudes are different enough, then the result of the operation could even be equal to the larger operand. In vivo: http://dpaste.dzfl.pl/870c5e61d276 |
February 17, 2015 Re: BigFloat? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dominikus Dittes Scherkl | On Tuesday, 17 February 2015 at 13:55:15 UTC, Dominikus Dittes Scherkl wrote:
> We have rational (two bigint, one for the numerator and one for the denominator), which I like better than floatingpoint (it's more expressive).
Yeah, this is probably the best that can be done, since any arbitrary-precision float is just gonna be a subset of Q anyway.
|
Copyright © 1999-2021 by the D Language Foundation