From: Hugo van der Sanden Date: Sun, 3 Jun 2001 04:26:36 +0000 (+0100) Subject: Re: 'decimal digits' macro? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=58a9a5d5decdad14b14ae7eccc5dfaa8de6eddd9;p=p5sagit%2Fp5-mst-13.2.git Re: 'decimal digits' macro? Message-Id: <200106030326.EAA18786@crypt.compulink.co.uk> p4raw-id: //depot/perl@10397 --- diff --git a/handy.h b/handy.h index 99cb5c6..76cbf2e 100644 --- a/handy.h +++ b/handy.h @@ -194,6 +194,7 @@ typedef U64TYPE U64; #endif +/* log(2) is pretty close to 0.30103, just in case anyone is grepping for it */ #define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */ #define TYPE_DIGITS(T) BIT_DIGITS(sizeof(T) * 8) #define TYPE_CHARS(T) (TYPE_DIGITS(T) + 2) /* sign, NUL */ diff --git a/t/lib/posix.t b/t/lib/posix.t index 994704a..7c91eba 100755 --- a/t/lib/posix.t +++ b/t/lib/posix.t @@ -80,7 +80,7 @@ if ($Config{d_strtod}) { $lc = &POSIX::setlocale(&POSIX::LC_NUMERIC, 'C') if $Config{d_setlocale}; ($n, $x) = &POSIX::strtod('3.14159_OR_SO'); # Using long double NVs may introduce greater accuracy than wanted. - $n =~ s/^3.14158999\d*$/3.14159/ + $n =~ s/^3.1415(8999|9000)\d*$/3.14159/ if $Config{uselongdouble} eq 'define'; print (($n == 3.14159) && ($x == 6) ? "ok 14\n" : "not ok 14\n"); &POSIX::setlocale(&POSIX::LC_NUMERIC, $lc) if $Config{d_setlocale}; diff --git a/t/op/tr.t b/t/op/tr.t index 1e30365..5c75b60 100755 --- a/t/op/tr.t +++ b/t/op/tr.t @@ -43,7 +43,7 @@ print "ok 3\n"; (my $y = 12) =~ tr/1/3/; ($f = 1.5) =~ tr/1/3/; (my $g = 1.5) =~ tr/1/3/; -print "not " unless $x + $y + $f + $g == 71; +print "not " unless $x + $y + $f + $g > 70.9; print "ok 5\n"; # make sure tr is harmless if not updating - see [ID 20000511.005]