Skip to content

sbyte array comparison doesn't work correctly with negative values #5263

@manofstick

Description

@manofstick

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-LibraryIssues for FSharp.Core not covered elsewhereBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions