boostorg / boostorg/multiprecision

Tie-to-even rule is not followed for overload remainder(float128, int)

Open
#639 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
265
Forks
128
Avg merge
4h 48m
Merged PRs (30d)
2

Description

Running the following code
```c++
#include
#include

int main() {
using std::remainder;
boost::multiprecision::float128 x = 180, d = 360;
std::cout << remainder(x, 360) << " " << remainder(x, d) << "\n";
}
```
prints out `-180 180`. I expected both numbers to be the same and the tie-to-even rule for `remainder` dictates that `180` is the correct result.

I'm on a Fedora 40 machine with boost version 18.3.0 installed.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the mismatch with the example that includes boost/multiprecision/float128.hpp, comparing remainder(x, 360) with remainder(x, d). Inspect the overloads involved in that header and add regression coverage showing that the tie-to-even result is consistent for the integer and float128 divisor cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.