0

I cannot find how to use infinities with BC Math. Let's take something like:

$result = echo bcdiv("1", $divider);

It goes all well until $divider is 0. So you make an exception:

if (!bccomp($divider, "0")) {
    $result = echo bcdiv("1", $divider);
}
else {
    $result = INF;
}

The problem is that $result gets computed as "0" in future calculations. I can set $result as an arbitrary large number, but that destroys the concept of exact calculations. Also, it will get much slower if I put a too large number in order to get accurate calculations.

Is there a way to overcome this?

0 Answers0