All Projects → krowinski → bcmath-extended

krowinski / bcmath-extended

Licence: MIT License
Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to bcmath-extended

Decimal
Arbitrary-precision fixed-point decimal numbers in go
Stars: ✭ 3,588 (+5981.36%)
Mutual labels:  money, decimals, bignumber
Calc
C-style arbitrary precision calculator
Stars: ✭ 127 (+115.25%)
Mutual labels:  math, arbitrary-precision, complex-numbers
Algebra
means completeness and balancing, from the Arabic word الجبر
Stars: ✭ 92 (+55.93%)
Mutual labels:  math, complex-numbers
Numphp
Mathematical PHP library for scientific computing
Stars: ✭ 120 (+103.39%)
Mutual labels:  math, complex-numbers
Javascript Biginteger
A big integer library for JavaScript
Stars: ✭ 181 (+206.78%)
Mutual labels:  math, arbitrary-precision
Rpn
Math functional language, inspired by Hewlett-Packard Reverse Polish Notation (RPL) language
Stars: ✭ 17 (-71.19%)
Mutual labels:  math, arbitrary-precision
Swift Numerics
Numerical APIs for Swift
Stars: ✭ 1,052 (+1683.05%)
Mutual labels:  math, complex-numbers
Mathjs
An extensive math library for JavaScript and Node.js
Stars: ✭ 11,861 (+20003.39%)
Mutual labels:  math, complex-numbers
Euler
The open-source computational framework for the Swift language
Stars: ✭ 37 (-37.29%)
Mutual labels:  math, bignumber
mathcore
Advanced .NET math library (.NET Standard).
Stars: ✭ 24 (-59.32%)
Mutual labels:  math, complex-numbers
Decimal
A high-performance, arbitrary-precision, floating-point decimal library.
Stars: ✭ 363 (+515.25%)
Mutual labels:  money, arbitrary-precision
java.math.expression.parser
java math expression parser is faster than JEP
Stars: ✭ 25 (-57.63%)
Mutual labels:  math, complex-numbers
Grassmann.jl
⟨Leibniz-Grassmann-Clifford⟩ differential geometric algebra / multivector simplicial complex
Stars: ✭ 289 (+389.83%)
Mutual labels:  math, complex-numbers
Angourimath
Open-source symbolic algebra library for C# and F#. One of the most powerful in .NET
Stars: ✭ 266 (+350.85%)
Mutual labels:  math, arbitrary-precision
Swift Complex
Complex numbers in Swift
Stars: ✭ 66 (+11.86%)
Mutual labels:  math, complex-numbers
imath
Arbitrary precision integer and rational arithmetic library
Stars: ✭ 92 (+55.93%)
Mutual labels:  math, arbitrary-precision
Big Math
Advanced Java BigDecimal math functions (pow, sqrt, log, sin, ...) using arbitrary precision.
Stars: ✭ 173 (+193.22%)
Mutual labels:  arbitrary-precision, complex-numbers
Measurements.jl
Error propagation calculator and library for physical measurements. It supports real and complex numbers with uncertainty, arbitrary precision calculations, operations with arrays, and numerical integration.
Stars: ✭ 248 (+320.34%)
Mutual labels:  arbitrary-precision, complex-numbers
hebimath
arbitrary precision arithmetic library
Stars: ✭ 37 (-37.29%)
Mutual labels:  arbitrary-precision, bignumber
math
Complex special functions and common mathematical operations in JavaScript
Stars: ✭ 42 (-28.81%)
Mutual labels:  arbitrary-precision, complex-numbers

bcmath-extended

Build Status Code Coverage Latest Stable Version Total Downloads License

Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions. (more http://php.net/manual/en/book.bc.php)

Installation

composer require krowinski/bcmath-extended

Features

  • config
    • setTrimTrailingZeroes - disable|enable trailing zeros (default trimming is enabled)
  • new tool methods
    • convertScientificNotationToString - converts scientific notation to string
    • getScale - gets current global scale
    • getDecimalsLengthFromNumber - gets amount of decimals
    • hexdec - converting from hexadecimal to decimal
    • dechex - converting from decimal to hexadecimal
    • bin2dec - converting from binary to decimal
    • dec2bin - converting from decimal to binary
  • new math functions
    • round
    • abs
    • rand
    • max
    • min
    • roundDown
    • roundUp
    • roundHalfEven
    • ceil
    • exp
    • log
    • fact
    • pow (supports fractional)
    • mod (supports fractional + scale in php 5.6 <)
    • bitwise operators
      • bitXor
      • bitOr
      • bitAnd
  • proxy for original functions (http://php.net/manual/en/book.bc.php)
  • all functions supports scientific notation
  • all functions are static, so it can be easy replaced by this lib

Info

As of 7.2 float can be passed to bcmod but they don't return correct values (IMO)

I created bug for this in https://bugs.php.net/bug.php?id=76287 but it was commented as documentation issue not a bug.

bcmod() doesn't use floor() but rather truncates towards zero,
which is also defined this way for POSIX fmod(), so that the
result always has the same sign as the dividend.  Therefore, this
is not a bug, but rather a documentation issue.

But I still will use floor not truncated for mod in this lib.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].