www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - BigFloat?

reply "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
We've got arbitrary precision integers, why not arbitrary 
precision floating point?
Feb 16 2015
parent reply "Kagamin" <spam here.lot> writes:
Periodic fractions.
Feb 17 2015
parent reply "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
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.
Feb 17 2015
next sibling parent reply "Dominikus Dittes Scherkl" writes:
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).
Feb 17 2015
parent "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
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.
Feb 17 2015
prev sibling parent reply "Kagamin" <spam here.lot> writes:
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.
Feb 17 2015
parent "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
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
Feb 17 2015