Skip to content

xmath.FloorSqrt*() divide by zero when N==max #1

@christophershirk

Description

@christophershirk

e.g, for TestFloorSqrt64(), adding {math.MaxUint64, math.MaxUint32} to 'tcs' slice will trigger integer divide by zero panic.

@@ -142,6 +142,7 @@ func TestFloorSqrt64(t *testing.T) {
                {1<<20 + 1, 1 << 10},
                {math.MaxUint32 - 1, math.MaxUint16},
                {math.MaxUint64 - 1, math.MaxUint32},
+               {math.MaxUint64, math.MaxUint32},
        }
        for _, tc := range tcs {
                if s := xmath.FloorSqrt64(tc.n); s != tc.s {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions