[SR-8070] remainder(dividingBy:) returns negative numbers #50603
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Mac Pro 3,1 (Early 2008)
OS X 10.11.6 El Capitan
Playground in Xcode 8.2.1
Additional Detail from JIRA
md5: b3d158018dcb18a29275569d3bac18a5
Issue Description:
For some inputs, remainder(dividingBy🙂 returns a negative number. Tested specifically with dividingBy: 2, the results seem to alternate between 1 and -1 as the input increases.
e.g.
1.remainder(dividingBy: 2) == 1
3.remainder(dividingBy: 2) == -1
5.remainder(dividingBy: 2) == 1
7.remainder(dividingBy: 2) == -1
etc.
I would expect the remainder when dividing by 2 to be 1 for all positive odd numbers.
The text was updated successfully, but these errors were encountered: