Using the PHP Function BCMath in Yoast SEO
bccomp is a function of the php library BCMath that’s bundled with PHP since version 4.0.4. We recently discovered that bcmath isn’t configured with PHP on a very small number of hosts, which means Yoast SEO encounters an error in the admin panel when trying to use a float in the add-to-cart function. Enabling bcmath in PHP will solve the problem right away.
The bcmath functions include bcadd(), bcsub(), bcmul(), bcdiv(), bcpow(), bcpowmod() and bcsqrt(). They allow you to work with arbitrary precision numbers by converting them to integer or string data types, using bcscale() to set the number of decimal places to compare to (bccomp compares only the numbers within the specified range of decimal places), and by comparing to an integer or float.
The function bccomp compares two arbitrary precision numbers and returns an integer that is the relative difference between them. It takes as its argument the left and right operands, with or without a decimal places argument. If the second operand is a float, you can set an additional argument to compare it with an integer. Otherwise, the function will compare the number to itself, and return 0 if both are equal, 1 if one is larger than the other and -1 if the first number is smaller than the second.