ENA, Section 1.4, Mentioned, A

Percentage Accurate: 53.2% → 99.9%
Time: 9.5s
Alternatives: 6
Speedup: 9.5×

Specification

?
\[-0.01 \leq x \land x \leq 0.01\]
\[\begin{array}{l} \\ 1 - \cos x \end{array} \]
(FPCore (x) :precision binary64 (- 1.0 (cos x)))
double code(double x) {
	return 1.0 - cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0 - cos(x)
end function
public static double code(double x) {
	return 1.0 - Math.cos(x);
}
def code(x):
	return 1.0 - math.cos(x)
function code(x)
	return Float64(1.0 - cos(x))
end
function tmp = code(x)
	tmp = 1.0 - cos(x);
end
code[x_] := N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 - \cos x
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 53.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 1 - \cos x \end{array} \]
(FPCore (x) :precision binary64 (- 1.0 (cos x)))
double code(double x) {
	return 1.0 - cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0 - cos(x)
end function
public static double code(double x) {
	return 1.0 - Math.cos(x);
}
def code(x):
	return 1.0 - math.cos(x)
function code(x)
	return Float64(1.0 - cos(x))
end
function tmp = code(x)
	tmp = 1.0 - cos(x);
end
code[x_] := N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 - \cos x
\end{array}

Alternative 1: 99.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \left(\mathsf{fma}\left(x \cdot x, -0.003472222222222222 \cdot \left(x \cdot x\right), \frac{--0.25}{\mathsf{fma}\left(0.041666666666666664, x \cdot x, 0.5\right)}\right) \cdot x\right) \cdot x \end{array} \]
(FPCore (x)
 :precision binary64
 (*
  (*
   (fma
    (* x x)
    (* -0.003472222222222222 (* x x))
    (/ (- -0.25) (fma 0.041666666666666664 (* x x) 0.5)))
   x)
  x))
double code(double x) {
	return (fma((x * x), (-0.003472222222222222 * (x * x)), (-(-0.25) / fma(0.041666666666666664, (x * x), 0.5))) * x) * x;
}
function code(x)
	return Float64(Float64(fma(Float64(x * x), Float64(-0.003472222222222222 * Float64(x * x)), Float64(Float64(-(-0.25)) / fma(0.041666666666666664, Float64(x * x), 0.5))) * x) * x)
end
code[x_] := N[(N[(N[(N[(x * x), $MachinePrecision] * N[(-0.003472222222222222 * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[((--0.25) / N[(0.041666666666666664 * N[(x * x), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}

\\
\left(\mathsf{fma}\left(x \cdot x, -0.003472222222222222 \cdot \left(x \cdot x\right), \frac{--0.25}{\mathsf{fma}\left(0.041666666666666664, x \cdot x, 0.5\right)}\right) \cdot x\right) \cdot x
\end{array}
Derivation
  1. Initial program 51.5%

    \[1 - \cos x \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right)} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \color{blue}{\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot {x}^{2}} \]
    2. unpow2N/A

      \[\leadsto \left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    3. associate-*r*N/A

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right) \cdot x} \]
    4. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right) \cdot x} \]
    5. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right)} \cdot x \]
    6. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left(\frac{-1}{24} \cdot {x}^{2} + \frac{1}{2}\right)} \cdot x\right) \cdot x \]
    7. lower-fma.f64N/A

      \[\leadsto \left(\color{blue}{\mathsf{fma}\left(\frac{-1}{24}, {x}^{2}, \frac{1}{2}\right)} \cdot x\right) \cdot x \]
    8. unpow2N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{24}, \color{blue}{x \cdot x}, \frac{1}{2}\right) \cdot x\right) \cdot x \]
    9. lower-*.f64100.0

      \[\leadsto \left(\mathsf{fma}\left(-0.041666666666666664, \color{blue}{x \cdot x}, 0.5\right) \cdot x\right) \cdot x \]
  5. Applied rewrites100.0%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.041666666666666664, x \cdot x, 0.5\right) \cdot x\right) \cdot x} \]
  6. Step-by-step derivation
    1. Applied rewrites100.0%

      \[\leadsto \left(\mathsf{fma}\left(x \cdot x, \frac{0.001736111111111111 \cdot \left(x \cdot x\right)}{\mathsf{fma}\left(-0.041666666666666664, x \cdot x, -0.5\right)}, -\frac{-0.25}{\mathsf{fma}\left(0.041666666666666664, x \cdot x, 0.5\right)}\right) \cdot x\right) \cdot x \]
    2. Taylor expanded in x around 0

      \[\leadsto \left(\mathsf{fma}\left(x \cdot x, \frac{-1}{288} \cdot {x}^{2}, -\frac{\frac{-1}{4}}{\mathsf{fma}\left(\frac{1}{24}, x \cdot x, \frac{1}{2}\right)}\right) \cdot x\right) \cdot x \]
    3. Step-by-step derivation
      1. Applied rewrites100.0%

        \[\leadsto \left(\mathsf{fma}\left(x \cdot x, -0.003472222222222222 \cdot \left(x \cdot x\right), -\frac{-0.25}{\mathsf{fma}\left(0.041666666666666664, x \cdot x, 0.5\right)}\right) \cdot x\right) \cdot x \]
      2. Final simplification100.0%

        \[\leadsto \left(\mathsf{fma}\left(x \cdot x, -0.003472222222222222 \cdot \left(x \cdot x\right), \frac{--0.25}{\mathsf{fma}\left(0.041666666666666664, x \cdot x, 0.5\right)}\right) \cdot x\right) \cdot x \]
      3. Add Preprocessing

      Alternative 2: 99.9% accurate, 4.7× speedup?

      \[\begin{array}{l} \\ \left(\mathsf{fma}\left(-0.041666666666666664, x \cdot x, 0.5\right) \cdot x\right) \cdot x \end{array} \]
      (FPCore (x)
       :precision binary64
       (* (* (fma -0.041666666666666664 (* x x) 0.5) x) x))
      double code(double x) {
      	return (fma(-0.041666666666666664, (x * x), 0.5) * x) * x;
      }
      
      function code(x)
      	return Float64(Float64(fma(-0.041666666666666664, Float64(x * x), 0.5) * x) * x)
      end
      
      code[x_] := N[(N[(N[(-0.041666666666666664 * N[(x * x), $MachinePrecision] + 0.5), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \left(\mathsf{fma}\left(-0.041666666666666664, x \cdot x, 0.5\right) \cdot x\right) \cdot x
      \end{array}
      
      Derivation
      1. Initial program 51.5%

        \[1 - \cos x \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot {x}^{2}} \]
        2. unpow2N/A

          \[\leadsto \left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
        3. associate-*r*N/A

          \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right) \cdot x} \]
        4. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right) \cdot x} \]
        5. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right)} \cdot x \]
        6. +-commutativeN/A

          \[\leadsto \left(\color{blue}{\left(\frac{-1}{24} \cdot {x}^{2} + \frac{1}{2}\right)} \cdot x\right) \cdot x \]
        7. lower-fma.f64N/A

          \[\leadsto \left(\color{blue}{\mathsf{fma}\left(\frac{-1}{24}, {x}^{2}, \frac{1}{2}\right)} \cdot x\right) \cdot x \]
        8. unpow2N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{24}, \color{blue}{x \cdot x}, \frac{1}{2}\right) \cdot x\right) \cdot x \]
        9. lower-*.f64100.0

          \[\leadsto \left(\mathsf{fma}\left(-0.041666666666666664, \color{blue}{x \cdot x}, 0.5\right) \cdot x\right) \cdot x \]
      5. Applied rewrites100.0%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.041666666666666664, x \cdot x, 0.5\right) \cdot x\right) \cdot x} \]
      6. Add Preprocessing

      Alternative 3: 99.6% accurate, 9.5× speedup?

      \[\begin{array}{l} \\ \left(0.5 \cdot x\right) \cdot x \end{array} \]
      (FPCore (x) :precision binary64 (* (* 0.5 x) x))
      double code(double x) {
      	return (0.5 * x) * x;
      }
      
      real(8) function code(x)
          real(8), intent (in) :: x
          code = (0.5d0 * x) * x
      end function
      
      public static double code(double x) {
      	return (0.5 * x) * x;
      }
      
      def code(x):
      	return (0.5 * x) * x
      
      function code(x)
      	return Float64(Float64(0.5 * x) * x)
      end
      
      function tmp = code(x)
      	tmp = (0.5 * x) * x;
      end
      
      code[x_] := N[(N[(0.5 * x), $MachinePrecision] * x), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \left(0.5 \cdot x\right) \cdot x
      \end{array}
      
      Derivation
      1. Initial program 51.5%

        \[1 - \cos x \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot {x}^{2}} \]
        2. unpow2N/A

          \[\leadsto \left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
        3. associate-*r*N/A

          \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right) \cdot x} \]
        4. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right) \cdot x} \]
        5. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\left(\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}\right) \cdot x\right)} \cdot x \]
        6. +-commutativeN/A

          \[\leadsto \left(\color{blue}{\left(\frac{-1}{24} \cdot {x}^{2} + \frac{1}{2}\right)} \cdot x\right) \cdot x \]
        7. lower-fma.f64N/A

          \[\leadsto \left(\color{blue}{\mathsf{fma}\left(\frac{-1}{24}, {x}^{2}, \frac{1}{2}\right)} \cdot x\right) \cdot x \]
        8. unpow2N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{24}, \color{blue}{x \cdot x}, \frac{1}{2}\right) \cdot x\right) \cdot x \]
        9. lower-*.f64100.0

          \[\leadsto \left(\mathsf{fma}\left(-0.041666666666666664, \color{blue}{x \cdot x}, 0.5\right) \cdot x\right) \cdot x \]
      5. Applied rewrites100.0%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.041666666666666664, x \cdot x, 0.5\right) \cdot x\right) \cdot x} \]
      6. Taylor expanded in x around 0

        \[\leadsto \left(\frac{1}{2} \cdot x\right) \cdot x \]
      7. Step-by-step derivation
        1. Applied rewrites99.9%

          \[\leadsto \left(0.5 \cdot x\right) \cdot x \]
        2. Add Preprocessing

        Alternative 4: 99.5% accurate, 9.5× speedup?

        \[\begin{array}{l} \\ 0.5 \cdot \left(x \cdot x\right) \end{array} \]
        (FPCore (x) :precision binary64 (* 0.5 (* x x)))
        double code(double x) {
        	return 0.5 * (x * x);
        }
        
        real(8) function code(x)
            real(8), intent (in) :: x
            code = 0.5d0 * (x * x)
        end function
        
        public static double code(double x) {
        	return 0.5 * (x * x);
        }
        
        def code(x):
        	return 0.5 * (x * x)
        
        function code(x)
        	return Float64(0.5 * Float64(x * x))
        end
        
        function tmp = code(x)
        	tmp = 0.5 * (x * x);
        end
        
        code[x_] := N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        0.5 \cdot \left(x \cdot x\right)
        \end{array}
        
        Derivation
        1. Initial program 51.5%

          \[1 - \cos x \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{1}{2} \cdot {x}^{2}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{2}} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{2}} \]
          3. unpow2N/A

            \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{2} \]
          4. lower-*.f6499.9

            \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot 0.5 \]
        5. Applied rewrites99.9%

          \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot 0.5} \]
        6. Final simplification99.9%

          \[\leadsto 0.5 \cdot \left(x \cdot x\right) \]
        7. Add Preprocessing

        Alternative 5: 52.3% accurate, 26.0× speedup?

        \[\begin{array}{l} \\ 1 - 1 \end{array} \]
        (FPCore (x) :precision binary64 (- 1.0 1.0))
        double code(double x) {
        	return 1.0 - 1.0;
        }
        
        real(8) function code(x)
            real(8), intent (in) :: x
            code = 1.0d0 - 1.0d0
        end function
        
        public static double code(double x) {
        	return 1.0 - 1.0;
        }
        
        def code(x):
        	return 1.0 - 1.0
        
        function code(x)
        	return Float64(1.0 - 1.0)
        end
        
        function tmp = code(x)
        	tmp = 1.0 - 1.0;
        end
        
        code[x_] := N[(1.0 - 1.0), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        1 - 1
        \end{array}
        
        Derivation
        1. Initial program 51.5%

          \[1 - \cos x \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto 1 - \color{blue}{1} \]
        4. Step-by-step derivation
          1. Applied rewrites51.2%

            \[\leadsto 1 - \color{blue}{1} \]
          2. Add Preprocessing

          Alternative 6: 4.2% accurate, 104.0× speedup?

          \[\begin{array}{l} \\ 2 \end{array} \]
          (FPCore (x) :precision binary64 2.0)
          double code(double x) {
          	return 2.0;
          }
          
          real(8) function code(x)
              real(8), intent (in) :: x
              code = 2.0d0
          end function
          
          public static double code(double x) {
          	return 2.0;
          }
          
          def code(x):
          	return 2.0
          
          function code(x)
          	return 2.0
          end
          
          function tmp = code(x)
          	tmp = 2.0;
          end
          
          code[x_] := 2.0
          
          \begin{array}{l}
          
          \\
          2
          \end{array}
          
          Derivation
          1. Initial program 51.5%

            \[1 - \cos x \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto 1 - \color{blue}{1} \]
          4. Step-by-step derivation
            1. Applied rewrites51.2%

              \[\leadsto 1 - \color{blue}{1} \]
            2. Step-by-step derivation
              1. lift--.f64N/A

                \[\leadsto \color{blue}{1 - 1} \]
              2. sub-negN/A

                \[\leadsto \color{blue}{1 + \left(\mathsf{neg}\left(1\right)\right)} \]
              3. flip3-+N/A

                \[\leadsto \color{blue}{\frac{{1}^{3} + {\left(\mathsf{neg}\left(1\right)\right)}^{3}}{1 \cdot 1 + \left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\mathsf{neg}\left(1\right)\right) - 1 \cdot \left(\mathsf{neg}\left(1\right)\right)\right)}} \]
              4. sqr-powN/A

                \[\leadsto \frac{{1}^{3} + \color{blue}{{\left(\mathsf{neg}\left(1\right)\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(\mathsf{neg}\left(1\right)\right)}^{\left(\frac{3}{2}\right)}}}{1 \cdot 1 + \left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\mathsf{neg}\left(1\right)\right) - 1 \cdot \left(\mathsf{neg}\left(1\right)\right)\right)} \]
              5. unpow-prod-downN/A

                \[\leadsto \frac{{1}^{3} + \color{blue}{{\left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\mathsf{neg}\left(1\right)\right)\right)}^{\left(\frac{3}{2}\right)}}}{1 \cdot 1 + \left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\mathsf{neg}\left(1\right)\right) - 1 \cdot \left(\mathsf{neg}\left(1\right)\right)\right)} \]
              6. sqr-negN/A

                \[\leadsto \frac{{1}^{3} + {\color{blue}{\left(1 \cdot 1\right)}}^{\left(\frac{3}{2}\right)}}{1 \cdot 1 + \left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\mathsf{neg}\left(1\right)\right) - 1 \cdot \left(\mathsf{neg}\left(1\right)\right)\right)} \]
              7. pow-prod-downN/A

                \[\leadsto \frac{{1}^{3} + \color{blue}{{1}^{\left(\frac{3}{2}\right)} \cdot {1}^{\left(\frac{3}{2}\right)}}}{1 \cdot 1 + \left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\mathsf{neg}\left(1\right)\right) - 1 \cdot \left(\mathsf{neg}\left(1\right)\right)\right)} \]
              8. sqr-powN/A

                \[\leadsto \frac{{1}^{3} + \color{blue}{{1}^{3}}}{1 \cdot 1 + \left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\mathsf{neg}\left(1\right)\right) - 1 \cdot \left(\mathsf{neg}\left(1\right)\right)\right)} \]
              9. sqr-negN/A

                \[\leadsto \frac{{1}^{3} + {1}^{3}}{1 \cdot 1 + \left(\color{blue}{1 \cdot 1} - 1 \cdot \left(\mathsf{neg}\left(1\right)\right)\right)} \]
            3. Applied rewrites4.1%

              \[\leadsto \color{blue}{1 + 1} \]
            4. Taylor expanded in x around 0

              \[\leadsto \color{blue}{2} \]
            5. Step-by-step derivation
              1. Applied rewrites4.1%

                \[\leadsto \color{blue}{2} \]
              2. Add Preprocessing

              Developer Target 1: 100.0% accurate, 0.3× speedup?

              \[\begin{array}{l} \\ \frac{\sin x \cdot \sin x}{1 + \cos x} \end{array} \]
              (FPCore (x) :precision binary64 (/ (* (sin x) (sin x)) (+ 1.0 (cos x))))
              double code(double x) {
              	return (sin(x) * sin(x)) / (1.0 + cos(x));
              }
              
              real(8) function code(x)
                  real(8), intent (in) :: x
                  code = (sin(x) * sin(x)) / (1.0d0 + cos(x))
              end function
              
              public static double code(double x) {
              	return (Math.sin(x) * Math.sin(x)) / (1.0 + Math.cos(x));
              }
              
              def code(x):
              	return (math.sin(x) * math.sin(x)) / (1.0 + math.cos(x))
              
              function code(x)
              	return Float64(Float64(sin(x) * sin(x)) / Float64(1.0 + cos(x)))
              end
              
              function tmp = code(x)
              	tmp = (sin(x) * sin(x)) / (1.0 + cos(x));
              end
              
              code[x_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \frac{\sin x \cdot \sin x}{1 + \cos x}
              \end{array}
              

              Reproduce

              ?
              herbie shell --seed 2024255 
              (FPCore (x)
                :name "ENA, Section 1.4, Mentioned, A"
                :precision binary64
                :pre (and (<= -0.01 x) (<= x 0.01))
              
                :alt
                (! :herbie-platform default (/ (* (sin x) (sin x)) (+ 1 (cos x))))
              
                (- 1.0 (cos x)))