TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Rounding.Directed.Runtime

Executable directed rounding #

Exact rational intermediates support the four IEEERoundingMode choices; together with the dyadic rounders of Rounding.Directed.Dyadic, they implement addition, subtraction, multiplication, division, fused multiply-add, and square root.

Rounding thresholds, signed-zero behavior, and exceptional results follow the FloatFormat descriptor. Real and extended-real correctness theorems are provided separately by DirectedSemantics with their format and input hypotheses.

Directed rounding of exact rationals #

def FloatLib.Floats.Formats.BinaryInterchange.Model.roundRatMagnitudeDirectedScaled (fmt : FloatFormat) (roundMagnitudeUp sign : Bool) (numerator denominator : ) (exponent : ) :
Model fmt

Round a scaled positive rational magnitude to the adjacent lower or upper representable magnitude.

roundMagnitudeUp = false selects the lower magnitude and true selects the upper magnitude. The sign parameter supplies the sign to the format's packing, zero, and overflow constructors.

Instances For
    def FloatLib.Floats.Formats.BinaryInterchange.Model.roundRatWithRoundingScaled (fmt : FloatFormat) (mode : IEEERoundingMode) (sign : Bool) (numerator denominator : ) (exponent : ) :
    Model fmt

    Round an exact scaled signed rational according to an IEEE rounding direction.

    Instances For

      Round an exact signed rational according to an IEEE rounding direction.

      Instances For
        @[inline]
        def FloatLib.Floats.Formats.BinaryInterchange.Model.roundRatDownScaled (fmt : FloatFormat) (sign : Bool) (numerator denominator : ) (exponent : ) :
        Model fmt

        Round an exact scaled signed rational toward negative infinity.

        Instances For
          @[inline]
          def FloatLib.Floats.Formats.BinaryInterchange.Model.roundRatUpScaled (fmt : FloatFormat) (sign : Bool) (numerator denominator : ) (exponent : ) :
          Model fmt

          Round an exact scaled signed rational toward positive infinity.

          Instances For
            @[inline]
            def FloatLib.Floats.Formats.BinaryInterchange.Model.roundRatDown (fmt : FloatFormat) (sign : Bool) (numerator denominator : ) :
            Model fmt

            Round an exact signed rational toward negative infinity.

            Instances For
              @[inline]
              def FloatLib.Floats.Formats.BinaryInterchange.Model.roundRatUp (fmt : FloatFormat) (sign : Bool) (numerator denominator : ) :
              Model fmt

              Round an exact signed rational toward positive infinity.

              Instances For

                Arithmetic under an explicit rounding direction #

                @[inline]

                Signed zero for an exact addition result under mode.

                Instances For

                  IEEE addition under an explicit rounding direction.

                  Instances For
                    @[inline]

                    IEEE subtraction under an explicit rounding direction.

                    Instances For

                      IEEE multiplication under an explicit rounding direction.

                      Instances For

                        IEEE division under an explicit rounding direction.

                        Instances For

                          IEEE fused multiply-add under an explicit rounding direction.

                          Instances For

                            Directed square root #

                            Dyadic endpoint pair used to enclose a nonnegative square root.

                            Instances For

                              Compute a dyadic enclosure of the square root of a nonnegative exact dyadic.

                              Instances For

                                IEEE square root under an explicit rounding direction.

                                Instances For

                                  Interval-friendly operation names #

                                  @[inline]

                                  Addition rounded toward negative infinity.

                                  Instances For
                                    @[inline]

                                    Addition rounded toward positive infinity.

                                    Instances For
                                      @[inline]

                                      Subtraction rounded toward negative infinity.

                                      Instances For
                                        @[inline]

                                        Subtraction rounded toward positive infinity.

                                        Instances For
                                          @[inline]

                                          Multiplication rounded toward negative infinity.

                                          Instances For
                                            @[inline]

                                            Multiplication rounded toward positive infinity.

                                            Instances For
                                              @[inline]

                                              Division rounded toward negative infinity.

                                              Instances For
                                                @[inline]

                                                Division rounded toward positive infinity.

                                                Instances For
                                                  @[inline]

                                                  Fused multiply-add rounded toward negative infinity.

                                                  Instances For
                                                    @[inline]

                                                    Fused multiply-add rounded toward positive infinity.

                                                    Instances For
                                                      @[inline]

                                                      Square root rounded toward negative infinity.

                                                      Instances For
                                                        @[inline]

                                                        Square root rounded toward positive infinity.

                                                        Instances For