On Wed, Feb 02, 2005 at 07:04:51AM -0500, Erick Bourgeois wrote:
> The documentation for strtod states the following:
> 
> if (($str eq '') || ($n_unparsed != 0) || !$!)
> 
> However, if you negate $!, I believe this has the opposite effect of 
> what you *really* want to test. If $! remains 0, this means strtod was 
> successful. Should it not be?:
> 
> if (($str eq '') || ($n_unparsed != 0) || $!)

Well-spotted. Fixed by the change below. The next line was wrong too!

-- 
Fire extinguisher (n) a device for holding open fire doors.

Change 23921 by [EMAIL PROTECTED] on 2005/02/02 18:25:00

        fix POSIX::strtod error handling documentation

Affected files ...

... //depot/perl/ext/POSIX/POSIX.pod#42 edit

Differences ...

==== //depot/perl/ext/POSIX/POSIX.pod#42 (text) ====

@@ -1342,8 +1342,8 @@
 
 The second returned item and $! can be used to check for valid input:
 
-    if (($str eq '') || ($n_unparsed != 0) || !$!) {
-        die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
+    if (($str eq '') || ($n_unparsed != 0) || $!) {
+        die "Non-numeric input $str" . ($! ? ": $!\n" : "\n");
     }
 
 When called in a scalar context strtod returns the parsed number.

Reply via email to