TorchLean API

FloatLib.Floats.ExecFloat.Comparison

Optional comparison capability for ExecFloat #

Comparison is format-defined rather than imposed by the universal carrier. IEEE binary formats use an unordered result for NaN, while standard posits use their total signed-word order, including NaR. Formats for which no comparison has been specified simply do not install this capability.

The public functions in this module give clients one spelling independently of the numerical family:

ExecFloat.compare left right
ExecFloat.compareEqual left right
ExecFloat.compareLess left right

Option Ordering retains the distinction between an ordered result and an unordered comparison. The Boolean predicates then follow each format's installed comparison without assuming IEEE, posit, real-number, or bitwise semantics.

Format-defined comparison for executable values.

none means unordered. A format with a total order returns some for every pair.

Instances
    @[inline]

    Compare two executable values according to their format's comparison semantics.

    Instances For
      @[inline]

      Format-defined numerical equality.

      For an unordered comparison this is false; consequently IEEE NaNs compare unequal. A format whose comparison is total may choose to include exceptional stored values in its equality.

      Instances For
        @[inline]

        Format-defined numerical inequality.

        This is the Boolean complement of compareEqual, so unordered pairs compare unequal.

        Instances For
          @[inline]

          Strict less-than; unordered comparisons return false.

          Instances For
            @[inline]

            Less-than-or-equal; unordered comparisons return false.

            Instances For
              @[inline]

              Strict greater-than; unordered comparisons return false.

              Instances For
                @[inline]

                Greater-than-or-equal; unordered comparisons return false.

                Instances For