#45330 [Opn->Fbk]: Incorrect outcomes gmp_pow

From: Date: Sun, 22 Jun 2008 17:08:21 +0000
Subject: #45330 [Opn->Fbk]: Incorrect outcomes gmp_pow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125939@lists.php.net to get a copy of this message
ID: 45330 Updated by: pajoye@php.net Reported By: duisters_k at hotmail dot com -Status: Open +Status: Feedback Bug Type: Math related Operating System: Win XP SP2 PHP Version: 5.2.6 New Comment: Can you give a comprehensible script without external values (no _GET)? and a clear output of this script and what you would expect, no need to comment it, only what the script outputs now and what you would like to have. Previous Comments: ------------------------------------------------------------------------ [2008-06-22 16:57:47] duisters_k at hotmail dot com Description: ------------ When I use gmp_init(), gmp_pow gives incorrect answers. Reproduce code: --------------- <pre><?php $iMessage = ord($_GET['message']); $rText = gmp_init($iMessage); $rRandE = gmp_init("7"); ?> Message: <?=gmp_strval($rText)?> <!-- 88 --> e: <?=gmp_strval($rRandE)?> <!-- 7 --> Message^e:<?=gmp_strval(gmp_pow($rText,$rRandE))?> 18979061712307928304713728 88^7: <?=gmp_strval(gmp_pow(88,7))?> 40867559636992 (It doesn't matter here whether I use strings or integers) pow(88,7):<?=pow(88,7)?> 40867559637000 Expected result: ---------------- Line 8 should give the same outcome as line 9 and (aproximatly) 10 Actual result: -------------- Different outcomes ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45330&edit=1

« previous php.bugs (#125939) next »