diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-01-25 19:42:30 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-01-25 19:42:30 +0000 |
commit | 2803fa059ea0dd9276f1b5bace7748e8b86790a5 (patch) | |
tree | 1b87042000df96f988e228b8d6960d76be39673e | |
parent | 5a17876fec93d2d9eeb8689d271a67aeaf8a99e2 (diff) | |
parent | c52f9dcd042177cd20ef53fca007b7305fd4972f (diff) | |
download | perl-2803fa059ea0dd9276f1b5bace7748e8b86790a5.tar.gz |
Integrate mainline
p4raw-id: //depot/perlio@8550
-rw-r--r-- | Makefile.SH | 13 | ||||
-rw-r--r-- | README.os390 | 37 | ||||
-rw-r--r-- | gv.c | 1 | ||||
-rw-r--r-- | hints/os390.sh | 41 | ||||
-rwxr-xr-x | installperl | 11 | ||||
-rw-r--r-- | lib/Math/BigFloat.pm | 28 | ||||
-rw-r--r-- | lib/Math/BigInt.pm | 1 | ||||
-rw-r--r-- | lib/overload.pm | 9 | ||||
-rw-r--r-- | perl.h | 5 | ||||
-rw-r--r-- | pod/perlguts.pod | 136 | ||||
-rwxr-xr-x | t/lib/bigfltpm.t | 66 | ||||
-rwxr-xr-x | t/lib/bigintpm.t | 10 |
12 files changed, 261 insertions, 97 deletions
diff --git a/Makefile.SH b/Makefile.SH index e6a0ef4d13..81b01368a9 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -78,6 +78,7 @@ true) linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl" ;; os390*) + shrpldflags='-W l,dll' linklibperl='libperl.x' DPERL_EXTERNAL_GLOB='' ;; @@ -419,7 +420,7 @@ $(LIBPERL): $& perl$(OBJ_EXT) $(obj) $(LIBPERLEXPORT) case "$useshrplib" in true) $spitshell >>Makefile <<'!NO!SUBS!' - $(LD) $(SHRPLDFLAGS) -o $@ perl$(OBJ_EXT) $(obj) + $(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) !NO!SUBS! case "$osname" in aix) @@ -484,16 +485,16 @@ miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT) $spitshell >>Makefile <<'!NO!SUBS!' perl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + $(SHRPENV) $(LDLIBPTH) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) # This version, if specified in Configure, does ONLY those scripts which need # set-id emulation. Suidperl must be setuid root. It contains the "taint" @@ -501,7 +502,7 @@ quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs # has been invoked correctly. suidperl: $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + $(SHRPENV) $(LDLIBPTH) $(CC) -o suidperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) !NO!SUBS! diff --git a/README.os390 b/README.os390 index 35073322f6..3a87182df3 100644 --- a/README.os390 +++ b/README.os390 @@ -58,6 +58,9 @@ from source to eliminate any such trouble. You might also find GNU make (as well as Perl and Apache) in the red-piece/book "Open Source Software for OS/390 UNIX", SG24-5944-00 from IBM. +You might also want to have GNU groff for OS/390 installed before +running the `make install` step for Perl. + There is a syntax error in the /usr/include/sys/socket.h header file that IBM supplies with USS V2R7, V2R8, and possibly V2R9. The problem with the header file is that near the definition of the SO_REUSEPORT constant @@ -143,10 +146,13 @@ re extraction of the source tar ball. =item * -This port doesn't support dynamic loading. Although OS/390 has support -for DLLs via dllload(), there are some differences that cause problems -for Perl. (We need a volunteer to write a ext/DynaLoader/dl_dllload.xs -file). +This port will support dynamic loading, but it is not selected by +default. If you would like to experiment with dynamic loading then +be sure to specify -Dusedl in the arguments to the Configure script. +See the comments in hints/os390.sh for more information on dynamic loading. +If you build with dynamic loading then you will need to add the +$archlibexp/CORE directory to your LIBPATH environment variable in order +for perl to work. See the config.sh file for the value of $archlibexp. =item * @@ -260,6 +266,12 @@ from an account with write access to the directory entry for /tmp. =back +=head2 installation anomalies + +The installman script will try to run on OS/390. There will be fewer errors +if you have a roff utility installed. You can obtain GNU groff from the +Redbook SG24-5944-00 ftp site. + =head2 Usage Hints When using perl on OS/390 please keep in mind that the EBCDIC and ASCII @@ -321,8 +333,10 @@ Pure pure (that is non xs) modules may be installed via the usual: make test make install -You can also build xs based extensions to Perl for OS/390 but will need -to follow the instructions in ExtUtils::MakeMaker for building +If you built perl with dynamic loading capability then that would also +be the way to build xs based extensions. However, if you built perl with +the default static linking you can still build xs based extensions for OS/390 +but you will need to follow the instructions in ExtUtils::MakeMaker for building statically linked perl binaries. In the simplest configurations building a static perl + xs extension boils down to: @@ -337,12 +351,21 @@ In most cases people have reported better results with GNU make rather than the system's /bin/make program, whether for plain modules or for xs based extensions. +If the make process encounters trouble with either compilation or +linking then try setting the _C89_CCMODE to 1. Assuming sh is your +login shell then run: + + export _C89_CCMODE=1 + +If tcsh is your login shell then use the setenv command. + =head1 AUTHORS David Fiander and Peter Prymmer with thanks to Dennis Longnecker and William Raffloer for valuable reports, LPAR and PTF feedback. Thanks to Mike MacIsaac and Egon Terwedow for SG24-5944-00. Thanks to Ignasi Roca for pointing out the floating point problems. +Thanks to John Goodyear for dynamic loading help. =head1 SEE ALSO @@ -387,5 +410,7 @@ Updated 12 November 2000 for the 5.7.1 release of Perl. Updated 15 January 2001 for the 5.7.1 release of Perl. +Updated 24 January 2001 to mention dynamic loading. + =cut @@ -1411,6 +1411,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) lr = 1; } break; + case int_amg: case iter_amg: /* XXXX Eventually should do to_gv. */ /* FAIL safe */ return NULL; /* Delegate operation to standard mechanisms. */ diff --git a/hints/os390.sh b/hints/os390.sh index ee75172446..54787e8d9a 100644 --- a/hints/os390.sh +++ b/hints/os390.sh @@ -84,23 +84,37 @@ define) case "$useshrplib" in '') useshrplib='true' ;; esac - case "$dlext" in - '') dlext='dll' ;; - esac case "$dlsrc" in '') dlsrc='dl_dllload.xs' ;; esac - so='dll' - libperl='libperl.dll' + # For performance use 'so' at or beyond v2.8, 'dll' for 2.7 and prior versions + case "`uname -v`x`uname -r`" in + 02x0[89].*|02x1[0-9].*|[0-9][3-9]x*) + so='so' + case "$dlext" in + '') dlext='so' ;; + esac + ;; + *) + so='dll' + case "$dlext" in + '') dlext='dll' ;; + esac + ;; + esac + libperl="libperl.$so" ccflags="$ccflags -D_SHR_ENVIRON -DPERL_EXTERNAL_GLOB -Wc,dll" cccdlflags='-c -Wc,dll,EXPORTALL' # You might add '-Wl,EDIT=NO' to get rid of the symbol - # information at the end of the executable. - # - # The following will need to be modified for the installed libperl.x + # information at the end of the executable (=> smaller binaries). + # Do so with -Dldflags='-Wl,EDIT=NO'. + case "$ldflags" in + '') ldflags='' ;; + esac + # The following will need to be modified for the installed libperl.x. + # The modification to Config.pm is done by the installperl script after the build and test. ccdlflags="-W l,dll `pwd`/libperl.x" - ldflags='' - lddlflags='-W l,dll' + lddlflags="-W l,dll `pwd`/libperl.x" ;; esac # even on static builds using LIBPATH should be OK. @@ -140,7 +154,14 @@ esac # other things. Unfortunately, cppflags occurs too late to be of # value external to the script. This may need to be revisited # under a compiler other than c89. +case "$usedl" in +define) +echo 'cat >.$$.c; '"$cc"' -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTENDED -D_ALL_SOURCE -D_SHR_ENVIRON -E -Wc,NOLOC ${1+"$@"} .$$.c; rm .$$.c' > cppstdin + ;; +*) echo 'cat >.$$.c; '"$cc"' -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTENDED -D_ALL_SOURCE -E -Wc,NOLOC ${1+"$@"} .$$.c; rm .$$.c' > cppstdin + ;; +esac # # Note that Makefile.SH employs a bare yacc command to generate diff --git a/installperl b/installperl index e2e9f0f435..dbdd6b558e 100755 --- a/installperl +++ b/installperl @@ -117,7 +117,7 @@ find(sub { # print "[$_]\n" for sort keys %archpms; my $ver = $Config{version}; -my $release = substr($],0,3); # Not used presently. +my $release = substr($],0,3); # Not used currently. my $patchlevel = substr($],3,2); die "Patchlevel of perl ($patchlevel)", "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n" @@ -137,6 +137,15 @@ my $libperl = $Config{libperl}; my $so = $Config{so}; my $dlext = $Config{dlext}; my $dlsrc = $Config{dlsrc}; +if ($^O eq 'os390') { + my $pwd; + chomp($pwd=`pwd`); + my $archlibexp = $Config{archlibexp}; + my $usedl = $Config{usedl}; + if ($usedl eq 'define') { + `./$^X -pibak -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`; + } +} my $d_dosuid = $Config{d_dosuid}; my $binexp = $Config{binexp}; diff --git a/lib/Math/BigFloat.pm b/lib/Math/BigFloat.pm index 74a023e0d8..4c520fdd49 100644 --- a/lib/Math/BigFloat.pm +++ b/lib/Math/BigFloat.pm @@ -18,6 +18,7 @@ use overload scalar fdiv(${$_[0]},$_[1])}, 'neg' => sub {new Math::BigFloat &fneg}, 'abs' => sub {new Math::BigFloat &fabs}, +'int' => sub {new Math::BigInt &f2int}, qw( "" stringify @@ -58,6 +59,13 @@ sub stringify { return $n; } +sub import { + shift; + return unless @_; + die "unknown import: @_" unless @_ == 1 and $_[0] eq ':constant'; + overload::constant float => sub {Math::BigFloat->new(shift)}; +} + $div_scale = 40; # Rounding modes one of 'even', 'odd', '+inf', '-inf', 'zero' or 'trunc'. @@ -235,6 +243,26 @@ sub ffround { #(fnum_str, scale) return fnum_str } } } + +# Calculate the integer part of $x +sub f2int { #(fnum_str) return inum_str + local($x) = ${$_[$[]}; + if ($x eq 'NaN') { + die "Attempt to take int(NaN)"; + } else { + local($xm,$xe) = split('E',$x); + if ($xe >= 0) { + $xm . '0' x $xe; + } else { + $xe = length($xm)+$xe; + if ($xe <= 1) { + '+0'; + } else { + substr($xm,$[,$xe); + } + } + } +} # compare 2 values returns one of undef, <0, =0, >0 # returns undef if either or both input value are not numbers diff --git a/lib/Math/BigInt.pm b/lib/Math/BigInt.pm index 066577d4cc..839b746c24 100644 --- a/lib/Math/BigInt.pm +++ b/lib/Math/BigInt.pm @@ -25,6 +25,7 @@ use overload '|' => sub {new Math::BigInt &bior}, '^' => sub {new Math::BigInt &bxor}, '~' => sub {new Math::BigInt &bnot}, +'int' => sub { shift }, qw( "" stringify diff --git a/lib/overload.pm b/lib/overload.pm index 69092a00cf..712c8eda57 100644 --- a/lib/overload.pm +++ b/lib/overload.pm @@ -123,7 +123,7 @@ sub mycan { # Real can would leave stubs. binary => "& | ^", unary => "neg ! ~", mutators => '++ --', - func => "atan2 cos sin exp abs log sqrt", + func => "atan2 cos sin exp abs log sqrt int", conversion => 'bool "" 0+', iterators => '<>', dereferencing => '${} @{} %{} &{} *{}', @@ -370,11 +370,16 @@ postfix form. =item * I<Transcendental functions> - "atan2", "cos", "sin", "exp", "abs", "log", "sqrt", + "atan2", "cos", "sin", "exp", "abs", "log", "sqrt", "int" If C<abs> is unavailable, it can be autogenerated using methods for "E<lt>" or "E<lt>=E<gt>" combined with either unary minus or subtraction. +Note that traditionally the Perl function L<int> rounds to 0, thus for +floating-point-like types one should follow the same semantic. If +C<int> is unavailable, it can be autogenerated using the overloading of +C<0+>. + =item * I<Boolean, string and numeric conversion> "bool", "\"\"", "0+", @@ -3064,7 +3064,8 @@ enum { to_sv_amg, to_av_amg, to_hv_amg, to_gv_amg, to_cv_amg, iter_amg, - DESTROY_amg, max_amg_code + int_amg, DESTROY_amg, + max_amg_code /* Do not leave a trailing comma here. C9X allows it, C89 doesn't. */ }; @@ -3110,7 +3111,7 @@ EXTCONST char * PL_AMG_names[NofAMmeth] = { "(${}", "(@{}", "(%{}", "(*{}", "(&{}", "(<>", - "DESTROY", + "(int", "DESTROY", }; #else EXTCONST char * PL_AMG_names[NofAMmeth]; diff --git a/pod/perlguts.pod b/pod/perlguts.pod index 924e993964..8ff4a84a6e 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -1357,22 +1357,22 @@ function). Here is a handy table of equivalents between ordinary C and Perl's memory abstraction layer: - Instead Of: Use: - - t* p = malloc(n) New(id, p, n, t) - t* p = calloc(n, s) Newz(id, p, n, t) - p = realloc(p, n) Renew(p, n, t) - memcpy(dst, src, n) Copy(src, dst, n, t) - memmove(dst, src, n) Move(src, dst, n, t) - free(p) Safefree(p) - strdup(p) savepv(p) - strndup(p, n) savepvn(p, n) (Hey, strndup doesn't exist!) - memcpy/*(struct foo *) StructCopy(src, dst, t) - - t type - p pointer - ck cookie for the memory region (now unused) - n number of elements + Instead Of: Use: + + t* p = malloc(n) New(id, p, n, t) + t* p = calloc(n, s) Newz(id, p, n, t) + p = realloc(p, n) Renew(p, n, t) + memcpy(dst, src, n) Copy(src, dst, n, t) + memmove(dst, src, n) Move(src, dst, n, t) + free(p) Safefree(p) + strdup(p) savepv(p) + strndup(p, n) savepvn(p, n) (Hey, strndup doesn't exist!) + memcpy/*(struct foo *) StructCopy(src, dst, t) + + t type + p pointer + ck cookie for the memory region (now unused) + n number of elements src source pointer dst destination pointer @@ -1721,10 +1721,10 @@ is normally hidden via macros. Consider C<sv_setsv>. It expands something like this: ifdef PERL_IMPLICIT_CONTEXT - define sv_setsv(a,b) Perl_sv_setsv(aTHX_ a, b) + define sv_setsv(a,b) Perl_sv_setsv(aTHX_ a, b) /* can't do this for vararg functions, see below */ else - define sv_setsv Perl_sv_setsv + define sv_setsv Perl_sv_setsv endif This works well, and means that XS authors can gleefully write: @@ -1799,31 +1799,31 @@ work. The second, more efficient way is to use the following template for your Foo.xs: - #define PERL_NO_GET_CONTEXT /* we want efficiency */ - #include "EXTERN.h" - #include "perl.h" - #include "XSUB.h" + #define PERL_NO_GET_CONTEXT /* we want efficiency */ + #include "EXTERN.h" + #include "perl.h" + #include "XSUB.h" static my_private_function(int arg1, int arg2); - static SV * - my_private_function(int arg1, int arg2) - { - dTHX; /* fetch context */ - ... call many Perl API functions ... - } + static SV * + my_private_function(int arg1, int arg2) + { + dTHX; /* fetch context */ + ... call many Perl API functions ... + } [... etc ...] - MODULE = Foo PACKAGE = Foo + MODULE = Foo PACKAGE = Foo - /* typical XSUB */ + /* typical XSUB */ - void - my_xsub(arg) - int arg - CODE: - my_private_function(arg, 10); + void + my_xsub(arg) + int arg + CODE: + my_private_function(arg, 10); Note that the only two changes from the normal way of writing an extension is the addition of a C<#define PERL_NO_GET_CONTEXT> before @@ -1838,32 +1838,32 @@ The third, even more efficient way is to ape how it is done within the Perl guts: - #define PERL_NO_GET_CONTEXT /* we want efficiency */ - #include "EXTERN.h" - #include "perl.h" - #include "XSUB.h" + #define PERL_NO_GET_CONTEXT /* we want efficiency */ + #include "EXTERN.h" + #include "perl.h" + #include "XSUB.h" /* pTHX_ only needed for functions that call Perl API */ static my_private_function(pTHX_ int arg1, int arg2); - static SV * - my_private_function(pTHX_ int arg1, int arg2) - { - /* dTHX; not needed here, because THX is an argument */ - ... call Perl API functions ... - } + static SV * + my_private_function(pTHX_ int arg1, int arg2) + { + /* dTHX; not needed here, because THX is an argument */ + ... call Perl API functions ... + } [... etc ...] - MODULE = Foo PACKAGE = Foo + MODULE = Foo PACKAGE = Foo - /* typical XSUB */ + /* typical XSUB */ - void - my_xsub(arg) - int arg - CODE: - my_private_function(aTHX_ arg, 10); + void + my_xsub(arg) + int arg + CODE: + my_private_function(aTHX_ arg, 10); This implementation never has to fetch the context using a function call, since it is always passed as an extra argument. Depending on @@ -1990,18 +1990,18 @@ If you are printing IVs, UVs, or NVS instead of the stdio(3) style formatting codes like C<%d>, C<%ld>, C<%f>, you should use the following macros for portability - IVdf IV in decimal - UVuf UV in decimal - UVof UV in octal - UVxf UV in hexadecimal - NVef NV %e-like - NVff NV %f-like - NVgf NV %g-like + IVdf IV in decimal + UVuf UV in decimal + UVof UV in octal + UVxf UV in hexadecimal + NVef NV %e-like + NVff NV %f-like + NVgf NV %g-like These will take care of 64-bit integers and long doubles. For example: - printf("IV is %"IVdf"\n", iv); + printf("IV is %"IVdf"\n", iv); The IVdf will expand to whatever is the correct format for the IVs. @@ -2013,20 +2013,20 @@ with PTR2UV(), do not use %lx or %p. Because pointer size does not necessarily equal integer size, use the follow macros to do it right. - PTR2UV(pointer) - PTR2IV(pointer) - PTR2NV(pointer) - INT2PTR(pointertotype, integer) + PTR2UV(pointer) + PTR2IV(pointer) + PTR2NV(pointer) + INT2PTR(pointertotype, integer) For example: - IV iv = ...; - SV *sv = INT2PTR(SV*, iv); + IV iv = ...; + SV *sv = INT2PTR(SV*, iv); and - AV *av = ...; - UV uv = PTR2UV(av); + AV *av = ...; + UV uv = PTR2UV(av); =head2 Source Documentation diff --git a/t/lib/bigfltpm.t b/t/lib/bigfltpm.t index b335d13016..a9725bad69 100755 --- a/t/lib/bigfltpm.t +++ b/t/lib/bigfltpm.t @@ -9,7 +9,7 @@ use Math::BigFloat; $test = 0; $| = 1; -print "1..362\n"; +print "1..406\n"; while (<DATA>) { chop; if (s/^&//) { @@ -33,6 +33,8 @@ while (<DATA>) { $try .= "-\$x;"; } elsif ($f eq "fabs") { $try .= "abs \$x;"; + } elsif ($f eq "fint") { + $try .= "int \$x;"; } elsif ($f eq "fround") { $try .= "0+\$x->fround($args[1]);"; } elsif ($f eq "ffround") { @@ -73,6 +75,25 @@ while (<DATA>) { } } } + +{ + use Math::BigFloat ':constant'; + + $test++; + # print "# " . 2. * '1427247692705959881058285969449495136382746624' . "\n"; + print "not " + unless 2. * '1427247692705959881058285969449495136382746624' + == "2854495385411919762116571938898990272765493248."; + print "ok $test\n"; + $test++; + @a = (); + for ($i = 1.; $i < 10; $i++) { + push @a, $i; + } + print "not " unless "@a" eq "1. 2. 3. 4. 5. 6. 7. 8. 9."; + print "ok $test\n"; +} + __END__ &fnorm abc:NaN. @@ -461,3 +482,46 @@ $Math::BigFloat::div_scale = 40 +100:10. +123.456:11.11107555549866648462149404118219234119 +15241.383936:123.456 +&fint ++0:+0 ++1:+1 ++11111111111111111234:+11111111111111111234 +-1:-1 +-11111111111111111234:-11111111111111111234 ++0.3:+0 ++1.3:+1 ++23.3:+23 ++12345678901234567890:+12345678901234567890 ++12345678901234567.890:+12345678901234567 ++12345678901234567890E13:+123456789012345678900000000000000 ++12345678901234567.890E13:+123456789012345678900000000000 ++12345678901234567890E-3:+12345678901234567 ++12345678901234567.890E-3:+12345678901234 ++12345678901234567890E-13:+1234567 ++12345678901234567.890E-13:+1234 ++12345678901234567890E-17:+123 ++12345678901234567.890E-16:+1 ++12345678901234567.890E-17:+0 ++12345678901234567890E-19:+1 ++12345678901234567890E-20:+0 ++12345678901234567890E-21:+0 ++12345678901234567890E-225:+0 +-0:+0 +-0.3:+0 +-1.3:-1 +-23.3:-23 +-12345678901234567890:-12345678901234567890 +-12345678901234567.890:-12345678901234567 +-12345678901234567890E13:-123456789012345678900000000000000 +-12345678901234567.890E13:-123456789012345678900000000000 +-12345678901234567890E-3:-12345678901234567 +-12345678901234567.890E-3:-12345678901234 +-12345678901234567890E-13:-1234567 +-12345678901234567.890E-13:-1234 +-12345678901234567890E-17:-123 +-12345678901234567.890E-16:-1 +-12345678901234567.890E-17:+0 +-12345678901234567890E-19:-1 +-12345678901234567890E-20:+0 +-12345678901234567890E-21:+0 +-12345678901234567890E-225:+0 diff --git a/t/lib/bigintpm.t b/t/lib/bigintpm.t index e76f246f18..dac6f5f4a0 100755 --- a/t/lib/bigintpm.t +++ b/t/lib/bigintpm.t @@ -9,7 +9,7 @@ use Math::BigInt; $test = 0; $| = 1; -print "1..278\n"; +print "1..283\n"; while (<DATA>) { chop; if (s/^&//) { @@ -25,6 +25,8 @@ while (<DATA>) { $try .= "-\$x;"; } elsif ($f eq "babs") { $try .= "abs \$x;"; + } elsif ($f eq "bint") { + $try .= "int \$x;"; } else { $try .= "\$y = new Math::BigInt \"$args[1]\";"; if ($f eq "bcmp"){ @@ -375,3 +377,9 @@ abc:NaN +0:-1 +8:-9 +281474976710656:-281474976710657 +&bint ++0:+0 ++1:+1 ++11111111111111111234:+11111111111111111234 +-1:-1 +-11111111111111111234:-11111111111111111234 |