search
HomePHP LibrariesOther librariesPHP library for handling very large numbers
PHP library for handling very large numbers
<?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());

This is a PHP library for processing extremely large numbers. Friends who need it can download it and use it.

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

Does PHP Offer a BigInteger Class for Large Integer Handling?Does PHP Offer a BigInteger Class for Large Integer Handling?

21Oct2024

BigInteger Class in PHPDoes PHP include a BigInteger class for handling large integers? If so, how is it accessed and utilized?Answer:While PHP does not natively include a BigInteger class, external libraries can provide this functionality. Two notab

What is the Most User-Friendly Form Validation Library for PHP with Comprehensive Features and Robust Error Handling?What is the Most User-Friendly Form Validation Library for PHP with Comprehensive Features and Robust Error Handling?

17Oct2024

Easiest Form Validation Library for PHPPHP boasts a plethora of validation libraries, each with its own strengths and weaknesses. To identify the ideal choice for your project, it's essential to consider factors such as simplicity, flexibility, and e

PHP example code for reading very large filesPHP example code for reading very large files

08Aug2016

: This article mainly introduces the example code for reading very large files in PHP. Students who are interested in PHP tutorials can refer to it.

PHP Streams: Efficient Data Handling for Large FilesPHP Streams: Efficient Data Handling for Large Files

08Dec2024

Topics: PHP Streams, File Handling in PHP, Large Dataset Processing, CSV Processing, PHP Performance Optimization Table of Contents Introduction Overview of PHP Streams Benefits of Using Streams Hands-On Example with Part-by

PHP encapsulation class sharing for quickly reading large CSV files line by line (also applicable to other very large text files)_PHP TutorialPHP encapsulation class sharing for quickly reading large CSV files line by line (also applicable to other very large text files)_PHP Tutorial

13Jul2016

Sharing of encapsulation classes for PHP to quickly read large CSV files line by line (also applicable to other very large text files). The reading of large CSV files has been described before (code examples of PHP reading and processing large CSV files line by line), but there are still some problems in how to quickly and completely operate large files.

What Mechanisms Does PHP Provide for Handling Large Integers?What Mechanisms Does PHP Provide for Handling Large Integers?

21Oct2024

PHP's Built-in BigInteger ClassPHP offers built-in support for handling large-scale integers through the BigInteger class. This class provides efficient operations for manipulating integers beyond the typical integer range.Accessing the BigInteger Cl

See all articles