develooper Front page | perl.perl6.internals | Postings from July 2002

[perl #825] [PATCH] Fix underflow error in fact_x_i

Thread Previous
From:
Tony Payne
Date:
July 16, 2002 15:19
Subject:
[perl #825] [PATCH] Fix underflow error in fact_x_i
Message ID:
rt-825-3880.7.18127268347374@perl
# New Ticket Created by  Tony Payne 
# Please include the string:  [perl #825]
# in the subject line of all future correspondence about this issue. 
# <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=825 >



Conversion from a signed (int,float) to an unsigned int was causing
underflow.  Therefore, fact(-1) becomes fact(UINT_MAX), which is
absurdly large :-).  With this patch, it returns 0.  Tests are also
included.

++t



-- attachment  1 ------------------------------------------------------
url: http://bugs6.perl.org/rt2/attach/3880/3590/523641/fact.diff


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About