|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-12-31 01:10 UTC] andkos11 at gmail dot com
Description:
------------
When tested bcpowmod, I saw that sometimes it returns wrong results, and only after this functions is twice replaced by the correct result, but this error does not occur every time so I could be a problem to observe it
The number for this wrong result
a = 26876030130522977362132073521581183346181374574161923861784515294359096339790317651642545453710861830,
b = 77317036686803103778936280840587979061852865432165222860201467725250008729818881455247433896121539492,
c = 23419441391667485230412027806848395891480806969028551095494276441653557878516815994557378094191773302
Test script:
---------------
if(!empty($_GET['a']) && !empty($_GET['b']) && !empty($_GET['c']))
{
echo bcpowmod($_GET['a'], $_GET['b'], $_GET['c']);
}
Expected result:
----------------
7900166398097084738516054342209138549045537503223180351418154803251628881304583728795337234416935756
Actual result:
--------------
1214699235616625452989024013318099653900761106780848559004042547497269228234090040172747025.4033420042
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 22 03:00:01 2025 UTC |
Test script: <?php if(!empty($_GET['a']) && !empty($_GET['b']) && !empty($_GET['c'])) { echo bcpowmod($_GET['a'], $_GET['b'], $_GET['c']); } ?>Thanks for the update. Unfortunately i still can't reproduce what you're saying. Even running it this way for ($i = 0; $i < 4; $i++) { echo bcpowmod( "26876030130522977362132073521581183346181374574161923861784515294359096339790317651642545453710861830", "77317036686803103778936280840587979061852865432165222860201467725250008729818881455247433896121539492", "23419441391667485230412027806848395891480806969028551095494276441653557878516815994557378094191773302" ); echo "\n"; } and always seeing 7900166398097084738516054342209138549045537503223180351418154803251628881304583728795337234416935756 7900166398097084738516054342209138549045537503223180351418154803251628881304583728795337234416935756 7900166398097084738516054342209138549045537503223180351418154803251628881304583728795337234416935756 7900166398097084738516054342209138549045537503223180351418154803251628881304583728795337234416935756 Heh ... even 5.5 and master show no regression on this. Something else you maybe could observe/try, like changing ini, changing something in env, etc.? Thanks.