in reply to Re^4: subtraction issue
in thread subtraction issue
it takes n fixed-point decimal digits to exactly represent an n-bit fixed-point fractional binary number
Thank you for correcting me ... but shouldn't that be "n+1 fixed-point decimal digits" ?
Cheers,
Rob
Thank you for correcting me ... but shouldn't that be "n+1 fixed-point decimal digits" ?
Take out the "." and the "e-2" and we're left with 54 decimal digits.use strict; use warnings; use Math::MPFR qw(:mpfr); Rmpfr_set_default_prec(1000); my $d = 1 / 11; my $x = Math::MPFR->new($d); print "$x\n", length($x), "\n"; # (print() removes trailing zeros.) # Outputs: 9.09090909090909116141432377844466827809810638427734375e-2 58
Cheers,
Rob
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: subtraction issue
by pryrt (Abbot) on Jan 28, 2017 at 03:36 UTC | |
by syphilis (Archbishop) on Jan 28, 2017 at 06:59 UTC | |
by pryrt (Abbot) on Jan 28, 2017 at 18:30 UTC | |
by syphilis (Archbishop) on Jan 28, 2017 at 22:34 UTC | |
by syphilis (Archbishop) on Jan 29, 2017 at 09:14 UTC | |
| |
by BrowserUk (Patriarch) on Jan 28, 2017 at 13:45 UTC | |
by syphilis (Archbishop) on Jan 28, 2017 at 23:10 UTC | |
by BrowserUk (Patriarch) on Jan 29, 2017 at 00:58 UTC | |
|
In Section
Seekers of Perl Wisdom