Re: bcmod() behavior is different from what I expected

From: Date: Tue, 23 Jul 2024 03:10:42 +0000
Subject: Re: bcmod() behavior is different from what I expected
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
> Hi internals,
> 
> I noticed that bcmod() behavior is a little different from what I expected.
> 
> First, look at the following code for bcdiv():
> ```
> bcdiv('99', '100', 2); // '0.99'
> ```
> 
> So what should the following code be?
> ```
> bcmod('99', '100', 2);
> ```
> 
> The result is '99.00'.
> I was expecting '0.00' for this. I thought that if gave
> bcdiv() and bcmod() the exact same arguments, their results would not
> contradict each other.
> 
> To me this is unexpected behaviour, how do you think?
> 
> Regards,
> 
> Saki

However, considering the behavior of fdiv() and fmod(), the current
behavior of bcmod()may be correct and my thinking may be wrong...

Saki


Thread (3 messages)

« previous php.internals (#124552) next »