วันพุธที่ 30 เมษายน พ.ศ. 2557

10:33

ฟังก์ชัน bcpowmod()
หาค่ายกกำลังแล้วหารเอาแต่เศษ ด้วยฟังก์ชัน bcpowmod()





รูปแบบ
string bcpow ( string $left_operand , string $right_operand , string $modulus , int $scale )
$left_operand คือ ตัวเลขด้านซ้าย รูปแบบ string
$right_operand คือ ตัวเลขด้านขวา รูปแบบ string
$modulus คือ ตัวเลขสำหรับหารเอาแต่เศษ รูปแบบ string
$scale คือ จำนวนจุดทศนิยม

ตัวอย่าง
<?php

$a = bcpowmod($x, $y, $mod);
$b = bcmod(bcpow($x, $y), $mod);

?>
ค่าที่ออกมาคือ $a จะเท่ากับ $b

0 ความคิดเห็น:

แสดงความคิดเห็น