dotnet / dotnet/fsharp

sbyte array comparison doesn't work correctly with negative values

Open
#5,263 13 comments 1 reaction 0 assignees View on GitHub
Area-Library Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Whilst working on the `IComparable` (which includes the inequality operators) version of #5112, I found that the currently implementation of `sbyte[]` do not work correctly when one of the operands is negative.

#### Repro steps

let a = -1y
let b = 0y

printfn "%b" (a < b)
printfn "%b" ([a] < [b])
printfn "%b" ([|a|] < [|b|])

#### Expected behavior

true
true
true

#### Actual behavior

true
true
false

#### Known workarounds

None. Well could convert the array to a list and then do a comparison there (if you can).

#### Related information

This was found when I was creating the alternative implementation and then running against the test suite created in #577. So presumably this has been a bug dating back prior to the creation of that regression suite (Aug 9, 2015). So probably no urgency to fix, and when the next PR that I'm working on is done then it will be cleared up.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.