We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
float
Hi,
Currently, float modulo is computed as:
if($B.$isinstance(other, _b_.int)){ other = _b_.int.numerator(other) return fast_float((self.value % other + other) % other) } if($B.$isinstance(other, float)){ // use truncated division // cf https://en.wikipedia.org/wiki/Modulo_operation var q = Math.floor(self.value / other.value), r = self.value - other.value * q if(r == 0 && other.value < 0){ return fast_float(-0) } return fast_float(r) }
Is there a reason to not simply use the following formula ?
const mod = (a % b + b) % b; // the formula used everywhere in the code. if( mod === 0 && b < 0 ) // handle -0. return -0; return mod;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
Currently, float modulo is computed as:
Is there a reason to not simply use the following formula ?
The text was updated successfully, but these errors were encountered: