Home >Backend Development >PHP Problem >What does the bc prefix in php bccomp mean?

What does the bc prefix in php bccomp mean?

藏色散人
藏色散人Original
2021-09-17 09:49:351764browse

php The bc prefix in bccomp indicates that the function belongs to the function in the high-precision operation BC function library, and the function of the bccomp function is to compare two arbitrary-precision numbers. The syntax is "bccomp(string $num1, string $num2,): int".

What does the bc prefix in php bccomp mean?

The operating environment of this article: Windows7 system, PHP7.1 version, Dell G3 computer

php The meaning of the bc prefix in bccomp is What?

PHP high-precision operation BC function library.

bccomp

bccomp — Compares two arbitrary-precision numbers

Description

bccomp(string $num1, string $num2, ?int $scale = null): int

Compares num1 and num2, and returns an integer type numeric result.

Parameter

num1

The operand on the left is a string.

num2

The operand on the right is a string.

scale

The optional scale parameter is used to set the indicator number in the decimal part used for comparison.

Return value

Returns 0 when the two numbers are equal; returns 1 when num1 is larger than num2; otherwise returns -1.

Related introduction:

BC mathematical functions are:

bcadd — Addition calculation of two arbitrary precision numbers

bccomp — Compare two arbitrary-precision numbers

bcdiv — Divide two arbitrary-precision numbers

bcmod — Modulo an arbitrary-precision number

bcmul — Multiply two arbitrary-precision numbers Compute

bcpow — Raise an arbitrary precision number to another, reduced by a specified modulus

bcscale — Set/get all bc math The default number of decimal points retained by the function

bcsqrt — the square root of an arbitrary precision number

bcsub — the subtraction of two arbitrary precision numbers

Recommended learning:《

PHP video tutorial

The above is the detailed content of What does the bc prefix in php bccomp mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn