Documentation

Overview

    Package cscalar provides a set of helper routines for dealing with complex128 values.

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func EqualWithinAbs

    func EqualWithinAbs(a, b complex128, tol float64) bool

      EqualWithinAbs returns true when a and b have an absolute difference not greater than tol.

      func EqualWithinAbsOrRel

      func EqualWithinAbsOrRel(a, b complex128, absTol, relTol float64) bool

        EqualWithinAbsOrRel returns true when a and b are equal to within the absolute or relative tolerances. See EqualWithinAbs and EqualWithinRel for details.

        func EqualWithinRel

        func EqualWithinRel(a, b complex128, tol float64) bool

          EqualWithinRel returns true when the difference between a and b is not greater than tol times the greater absolute value of a and b,

          abs(a-b) <= tol * max(abs(a), abs(b)).
          

          func ParseWithNA

          func ParseWithNA(s, missing string) (value complex128, weight float64, err error)

            ParseWithNA converts the string s to a complex128 in value. If s equals missing, weight is returned as 0, otherwise 1.

            Example
            Output:
            
            (5-1i)
            

            func Round

            func Round(x complex128, prec int) complex128

              Round returns the half away from zero rounded value of x with prec precision.

              Special cases are:

              Round(±0) = +0
              Round(±Inf) = ±Inf
              Round(NaN) = NaN
              

              func RoundEven

              func RoundEven(x complex128, prec int) complex128

                RoundEven returns the half even rounded value of x with prec precision.

                Special cases are:

                RoundEven(±0) = +0
                RoundEven(±Inf) = ±Inf
                RoundEven(NaN) = NaN
                

                func Same

                func Same(a, b complex128) bool

                  Same returns true when the inputs have the same value, allowing NaN equality.

                  Types

                  This section is empty.