Skip to content
FutureBlitz

    Install

    Import std.math.scalar

    Wrap

    std.math.scalar

    function

    Public Function Wrap<T>(value: T, low: T, high: T): T

    The value wrapped into the range from low to high, high left out, as an angle wraps into a turn: Wrap(370, 0, 360) is 10. With low equal to high, it's low. The distances are worked out in a UInt64, so a range of any width, in any of the eight types, can't overflow.

    Examples

    Expect(Wrap(370, 0, 360) == 10)
    Expect(Wrap(-30, 0, 360) == 330)

    std/math/scalar.fb, line 228

    function

    Public Function Wrap<T>(value: T, low: T, high: T): T

    The value wrapped into the range from low to high, high left out, as an angle wraps into a turn: Wrap(370.0, 0.0, 360.0) is 10. With low equal to high, it's low. One that rounds to high gives low, which is as near, a turn away.

    std/math/scalar.fb, line 244

    Report an issue with this page or with FutureBlitz on GitHub.