ID: 46564 Updated by: j...@php.net Reported By: shelby at coolpage dot com -Status: Open +Status: Verified Bug Type: BC math related -Operating System: BSD +Operating System: * -PHP Version: 5.2.6 +PHP Version: 5.*, 6CVS (2009-04-01)
Previous Comments: ------------------------------------------------------------------------ [2008-11-13 13:20:43] shelby at coolpage dot com Correction, need ">= 0": function bcmod( $op, $mod, $scale ) { while( ($t = bcsub( $op, $mod, $scale )) >= 0 ) $op = $t; return $op; } ------------------------------------------------------------------------ [2008-11-13 13:03:27] support at coolpage dot com Here is function that works correctly: function bcmod( $op, $mod, $scale ) { while( ($t = bcsub( $op, $mod, $scale )) > 0 ) $op = $t; return $op; } ------------------------------------------------------------------------ [2008-11-13 12:46:51] shelby at coolpage dot com Description: ------------ bcmod( '1071', '357.5' ) returns '0' Reproduce code: --------------- echo bcmod( '1071', '357.5' ); Expected result: ---------------- bcmod( '1071', '357.5' ) should return '356' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46564&edit=1