Closed p5pRT closed 20 years ago
i have noticed that on several FreeBSD machines that if you do something such as print 65536 ** 65536 . "\n"; or calculate 65536**65536 in any manner that it causes perl to core with a floating exception. I have tried this on some linux machines also\, and the linux machines just return 'inf' for the result of that calculation. both the freebsd and linux machines use perl 5.005_03. I am not sure as to whether this is a bug in perl itself or in some element of FreeBSD.
you klingon bastard \dive@​mokimaki\.ethereal\.net wrote
i have noticed that on several FreeBSD machines that if you do something such as print 65536 ** 65536 . "\n"; or calculate 65536**65536 in any manner that it causes perl to core with a floating exception. I have tried this on some linux machines also\, and the linux machines just return 'inf' for the result of that calculation. both the freebsd and linux machines use perl 5.005_03. I am not sure as to whether this is a bug in perl itself or in some element of FreeBSD.
More a feature than a bug. Perl simply does whatever the underlying C arithmetic does\, which will be platform-dependent.
You could always trap SIGFPE\, but it's not clear what you could usefully do next\, except die().
Mike Guy
i traced the bug/feature/whatever to the fact that perl on freebsd does not call fpsetmask to disable the exception handlers so that perl can do it on it's own. this patch will resolve the problem.
*** perl5.005_03/unixish.h Thu Feb 24 23:00:18 2000 --- perl5.005_03-orig/unixish.h Fri Feb 12 00:06:20 1999 *************** *** 7\,10 **** ! #ifdef __FreeBSD__ ! # include \<floatingpoint.h> ! # define PERL_SYS_INIT(c\,v) fpsetmask(0); MALLOC_INIT; ! #endif --- 7 ---- !
On Thu\, 17 Feb 2000\, M.J.T. Guy wrote:
you klingon bastard \dive@​mokimaki\.ethereal\.net wrote
i have noticed that on several FreeBSD machines that if you do something such as print 65536 ** 65536 . "\n"; or calculate 65536**65536 in any manner that it causes perl to core with a floating exception. I have tried this on some linux machines also\, and the linux machines just return 'inf' for the result of that calculation. both the freebsd and linux machines use perl 5.005_03. I am not sure as to whether this is a bug in perl itself or in some element of FreeBSD.
More a feature than a bug. Perl simply does whatever the underlying C arithmetic does\, which will be platform-dependent.
You could always trap SIGFPE\, but it's not clear what you could usefully do next\, except die().
Mike Guy
Migrated from rt.perl.org#2161 (status was 'resolved')
Searchable as RT2161$