# New Ticket Created by  "Stephen Simmons" 
# Please include the string:  [perl #58500]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=58500 >


With revision 30669, I find the following behavior of round()

sully:perl6 stephensimmons$ perl6 -e 'say round(3.5);'
4
sully:perl6 stephensimmons$ perl6 -e 'say round(3.4);'
3.9
sully:perl6 stephensimmons$ perl6 -e 'say round(3.6);'
4.1

It's trivial, but here is the diff of the fix:

sully:perl6 stephensimmons$ svn diff -r HEAD src/builtins/math.pir
Index: src/builtins/math.pir
===================================================================
--- src/builtins/math.pir (revision 30669)
+++ src/builtins/math.pir (working copy)
@@ -61,7 +61,7 @@
     .param num a
     a += 0.5
     $N0 = floor a
-    .return (a)
+    .return ($N0)
 .end

After:
sully:perl6 stephensimmons$ perl6 -e 'say round(3.4);'
3
sully:perl6 stephensimmons$ perl6 -e 'say round(4);'
4
sully:perl6 stephensimmons$ perl6 -e 'say round(3.6);'
4

Please let me know the proper form for submitting bug fixes.  I remember
reading it somewhere, but I couldn't find it tonight.

Stephen Simmons

Reply via email to