處理特大數字的PHP庫
<?php namespace Moontoast\Math; class BigNumberTest extends \PHPUnit_Framework_TestCase { protected function setUp() { ini_set('bcmath.scale', 0); } /** * @covers Moontoast\Math\BigNumber::__construct * @covers Moontoast\Math\BigNumber::getValue * @covers Moontoast\Math\BigNumber::getScale * @covers Moontoast\Math\BigNumber::setValue * @covers Moontoast\Math\BigNumber::filterNumber * @covers Moontoast\Math\BigNumber::setDefaultScale */ public function testConstruct() { $bn1 = new BigNumber('9,223,372,036,854,775,808'); $this->assertSame('9223372036854775808', $bn1->getValue()); $this->assertEquals(0, $bn1->getScale()); $bn2 = new BigNumber(2147483647); $this->assertSame('2147483647', $bn2->getValue()); $this->assertEquals(0, $bn2->getScale());
這是一份處理特大數字的PHP函式庫,需要的朋友可以下載使用。
免責聲明
本站所有資源皆由網友貢獻或各大下載網站轉載。請自行檢查軟體的完整性!本站所有資源僅供學習參考。請不要將它們用於商業目的。否則,一切後果都由您負責!如有侵權,請聯絡我們刪除。聯絡方式:admin@php.cn
相關文章

21Oct2024
在 PHP 中使用 BigInteger 類別 PHP 提供了多種處理大整數值的方法。 BigInteger 類別就是這樣的選項之一。但是,您可以使用外部程式庫

25Nov2024
在 JavaScript 中處理大數:本機 BigInt 與外部函式庫JavaScript 缺乏處理大數的內建解決方案,因此...


Hot Tools

熱門文章
丟失記錄:Bloom&Rage -Corey和Dylan的鎖組合
19Feb2025手游攻略
Hello Kitty 島冒險:巧克力貓角色指南
24Jan2025手游攻略
如何修復KB5050081無法在Windows 10中安裝?
31Jan2025故障排查
Hello Kitty Island冒險:重新啟動機器人任務演練
16Feb2025手游攻略
王朝勇士:起源 - Xinye練習之戰
26Jan2025手游攻略