TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Transcendentals.Trig

Format-generic executable sine and cosine #

Finite arguments are reduced against a configurable fixed-point approximation of pi / 2. Reduced sine and cosine values are evaluated from exact common-denominator Taylor polynomials and rounded once to Model fmt. Reduction checks Config.trigMaxExponent before constructing the scaled argument. sinCosResult and sinCosWithResult expose a budget failure; the value-only operations return the format's invalid result on failure. A full-range configuration can be requested explicitly.

For leading exponents below -(fracWidth + 2), the provider returns the input and one, preserving tiny sine results without converting them to the fixed-point reduction scale. The kernels remain deterministic approximations without a whole-algorithm accuracy or correct-rounding certificate.

A finite argument exceeds the exponent budget of the selected reduction data.

  • inputExponent :

    Leading binary exponent of the argument's absolute value.

  • maxExponent :

    Largest leading exponent accepted by the configuration.

Instances For

    Evaluate the reduced sine and cosine kernels and round each result once.

    Instances For

      Reduce a dyadic argument only within the configuration's exponent budget.

      Zero and tiny inputs need no reduction. An ok result records successful evaluation of the approximation policy; it does not certify numerical accuracy.

      Instances For
        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.Transcendentals.sinCosScaledWithResult_exponentBudget (fmt : FloatFormat) (config : Config) (value : Numerics.Dyadic) (hnonzero : value.significand 0) (hlarge : 0 Int.ofNat value.significand.log2 + value.exponent) (hbudget : config.trigMaxExponent < Int.ofNat value.significand.log2 + value.exponent) :
        sinCosScaledWithResult fmt config value = Except.error { inputExponent := Int.ofNat value.significand.log2 + value.exponent, maxExponent := config.trigMaxExponent }

        An oversized nonzero argument is rejected before fixed-point reduction, for every format.

        Reduce a dyadic argument, returning invalid results when the exponent budget is exceeded.

        Instances For

          Evaluate sine and cosine, preserving a reduction-budget failure in the result type.

          The provider is called only for finite, nonzero inputs outside the tiny-argument branch. Exceptional inputs retain their ordinary encoded results; this error type is not IEEE status.

          Instances For

            Evaluate sine and cosine, mapping reduction-budget failures to the format's invalid result.

            Instances For

              Joint sine/cosine approximation with explicit data and a separate reduction-budget error.

              Instances For

                Joint deterministic sine/cosine evaluation with explicit approximation data.

                Instances For
                  @[inline]

                  Deterministic sine with explicit approximation data.

                  Instances For
                    @[inline]

                    Deterministic cosine with explicit approximation data.

                    Instances For

                      The configured approximation to pi, rounded once to the destination format.

                      Instances For
                        @[inline]

                        Joint sine/cosine evaluation using the default configuration.

                        Instances For
                          @[inline]

                          Joint sine/cosine approximation with an explicit failure when default reduction is too small.

                          Instances For
                            @[inline]

                            Sine using the default configuration; a reduction-budget failure gives invalidResult.

                            Instances For
                              @[inline]

                              Cosine using the default configuration; a reduction-budget failure gives invalidResult.

                              Instances For
                                @[inline]

                                Pi using the default configuration for the destination format.

                                Instances For