Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math::BigFloat is not -w clean #166

Closed
p5pRT opened this issue Jul 7, 1999 · 2 comments
Closed

Math::BigFloat is not -w clean #166

p5pRT opened this issue Jul 7, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 7, 1999

Migrated from rt.perl.org#971 (status was 'resolved')

Searchable as RT971$

@p5pRT
Copy link
Author

p5pRT commented Jul 7, 1999

From mjtg@cus.cam.ac.uk

  $x = Math​::BigFloat->new(123);

gives "undefined" warnings.

Patch attached for 5.005_03, but should be OK for other versions.

I note in passing that there are no regression tests for this module,
but my enthusiasm didn't stretch to providing some. :-(

Mike Guy

And a message from our sponsors​: perl perl perl perl perl perl perl

Inline Patch
--- ./lib/Math/BigFloat.pm.orig	Thu Jan  7 04:41:53 1999
+++ ./lib/Math/BigFloat.pm	Wed Jul  7 16:05:05 1999
@@ -76,8 +76,10 @@
 sub fnorm { #(string) return fnum_str
     local($_) = @_;
     s/\s+//g;                               # strip white space
-    if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ && "$2$4" ne '') {
-	&norm(($1 ? "$1$2$4" : "+$2$4"),(($4 ne '') ? $6-length($4) : $6));
+    if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ &&
+           (length $2 || defined $4) {
+        my $x = defined $4 ? $4 : '';
+	&norm(($1||'+') . "$2$x", ($6||0)-length($x));
     } else {
 	'NaN';
     }

End of patch

@p5pRT
Copy link
Author

p5pRT commented Jul 26, 2000

From [Unknown Contact. See original ticket]

Original message from M.J.T. Guy (patch typo fixed as well). This is still
true in 5.6.0.

Math​::BigFloat is not -w clean. For example,

  $x = Math​::BigFloat->new(123);

gives "undefined" warnings.

Patch attached for 5.005_03, but should be OK for other versions.

I note in passing that there are no regression tests for this module,
but my enthusiasm didn't stretch to providing some. :-(

Mike Guy

And a message from our sponsors​: perl perl perl perl perl perl perl

--- ./lib/Math/BigFloat.pm.orig Thu Jan 7 04​:41​:53 1999
+++ ./lib/Math/BigFloat.pm Wed Jul 7 16​:05​:05 1999
@​@​ -76,8 +76,10 @​@​
  sub fnorm { #(string) return fnum_str
  local($_) = @​_;
  s/\s+//g; # strip white space
- if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ && "$2$4" ne '') {
- &norm(($1 ? "$1$2$4" : "+$2$4"),(($4 ne '') ? $6-length($4) :
$6));
+ if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ &&
+ (length $2 || defined $4)) {
+ my $x = defined $4 ? $4 : '';
+ &norm(($1||'+') . "$2$x", ($6||0)-length($x));
  } else {
  'NaN';
  }

End of patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant