#44995 [Opn]: bcpowmod() using a scale function always returns 0

From: Date: Sat, 19 Sep 2009 18:22:41 +0000
Subject: #44995 [Opn]: bcpowmod() using a scale function always returns 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142574@lists.php.net to get a copy of this message
 ID:               44995
 Updated by:       sjoerd@php.net
 Reported By:      nat at fishtrap dot co dot uk
 Status:           Open
 Bug Type:         BC math related
 Operating System: Linux
 PHP Version:      5.2CVS-2008-05-14 (snap)
 New Comment:

This seems to be a bug in the bc library. I asked jhasler to look into
it.


Previous Comments:
------------------------------------------------------------------------

[2008-05-14 16:26:56] nat at fishtrap dot co dot uk

Description:
------------
When using the 4th optional parameter of bcpowmod. The answer is always
zero and does not match the answer using bc directly.

This is also true if you set the scale using bcscale(1).

In short if the scale is non zero I can't find any way of getting
anything apart from zero as the result.

Reproduce code:
---------------
echo bcpowmod("4", "4", "3", 1 ) ,PHP_EOL;



Expected result:
----------------
0.1

in bc
scale =1;
4^4%3;
.1

Actual result:
--------------
0.0


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44995&edit=1



Thread (9 messages)

« previous php.bugs (#142574) next »