Skip to content

Length.Zero.Inverse() returns ReciprocalLength.Zero (v6) #1535

@lipchev

Description

@lipchev

Since the release/v6 supports NaN and PositiveInfinity I think it would make sense for:

        [Theory]
        [InlineData(-1.0, -1.0)]
        [InlineData(-2.0, -0.5)]
        [InlineData(0.0, 0.0)]
        [InlineData(1.0, 1.0)]
        [InlineData(2.0, 0.5)]
        public static void InverseReturnsReciprocalLength(double value, double expected)
        {
            var length = new Length(value, LengthUnit.Meter);
            var inverseLength = length.Inverse();

            Assert.Equal(expected, inverseLength.InverseMeters);
        }

to be changed to:

        [Theory]
        [InlineData(-1.0, -1.0)]
        [InlineData(-2.0, -0.5)]
        [InlineData(0.0, double.PositiveInfinity)]
        [InlineData(1.0, 1.0)]
        [InlineData(2.0, 0.5)]
        public static void InverseReturnsReciprocalLength(double value, double expected)
        {
            var length = new Length(value, LengthUnit.Meter);
            var inverseLength = length.Inverse();

            Assert.Equal(expected, inverseLength.InverseMeters);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions