
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 - cos(x)) / (x * x)
end function
public static double code(double x) {
return (1.0 - Math.cos(x)) / (x * x);
}
def code(x): return (1.0 - math.cos(x)) / (x * x)
function code(x) return Float64(Float64(1.0 - cos(x)) / Float64(x * x)) end
function tmp = code(x) tmp = (1.0 - cos(x)) / (x * x); end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - \cos x}{x \cdot x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 - cos(x)) / (x * x)
end function
public static double code(double x) {
return (1.0 - Math.cos(x)) / (x * x);
}
def code(x): return (1.0 - math.cos(x)) / (x * x)
function code(x) return Float64(Float64(1.0 - cos(x)) / Float64(x * x)) end
function tmp = code(x) tmp = (1.0 - cos(x)) / (x * x); end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - \cos x}{x \cdot x}
\end{array}
(FPCore (x) :precision binary64 (* (/ (sin x) x) (/ (tan (/ x 2.0)) x)))
double code(double x) {
return (sin(x) / x) * (tan((x / 2.0)) / x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (sin(x) / x) * (tan((x / 2.0d0)) / x)
end function
public static double code(double x) {
return (Math.sin(x) / x) * (Math.tan((x / 2.0)) / x);
}
def code(x): return (math.sin(x) / x) * (math.tan((x / 2.0)) / x)
function code(x) return Float64(Float64(sin(x) / x) * Float64(tan(Float64(x / 2.0)) / x)) end
function tmp = code(x) tmp = (sin(x) / x) * (tan((x / 2.0)) / x); end
code[x_] := N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * N[(N[Tan[N[(x / 2.0), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}
\end{array}
Initial program 50.4%
flip--N/A
associate-/l/N/A
metadata-evalN/A
1-sub-cosN/A
times-fracN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
hang-0p-tanN/A
tan-lowering-tan.f64N/A
/-lowering-/.f6476.0%
Applied egg-rr76.0%
associate-*l/N/A
times-fracN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f6499.9%
Applied egg-rr99.9%
(FPCore (x)
:precision binary64
(if (<= x 0.033)
(+
0.5
(* (* x x) (+ -0.041666666666666664 (* (* x x) 0.001388888888888889))))
(/ (/ 1.0 (/ x (- 1.0 (cos x)))) x)))
double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
} else {
tmp = (1.0 / (x / (1.0 - cos(x)))) / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.033d0) then
tmp = 0.5d0 + ((x * x) * ((-0.041666666666666664d0) + ((x * x) * 0.001388888888888889d0)))
else
tmp = (1.0d0 / (x / (1.0d0 - cos(x)))) / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
} else {
tmp = (1.0 / (x / (1.0 - Math.cos(x)))) / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.033: tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889))) else: tmp = (1.0 / (x / (1.0 - math.cos(x)))) / x return tmp
function code(x) tmp = 0.0 if (x <= 0.033) tmp = Float64(0.5 + Float64(Float64(x * x) * Float64(-0.041666666666666664 + Float64(Float64(x * x) * 0.001388888888888889)))); else tmp = Float64(Float64(1.0 / Float64(x / Float64(1.0 - cos(x)))) / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.033) tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889))); else tmp = (1.0 / (x / (1.0 - cos(x)))) / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.033], N[(0.5 + N[(N[(x * x), $MachinePrecision] * N[(-0.041666666666666664 + N[(N[(x * x), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x / N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.033:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\frac{x}{1 - \cos x}}}{x}\\
\end{array}
\end{array}
if x < 0.033000000000000002Initial program 35.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6466.5%
Simplified66.5%
if 0.033000000000000002 < x Initial program 98.7%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6499.3%
Simplified99.3%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6499.2%
Applied egg-rr99.2%
(FPCore (x)
:precision binary64
(if (<= x 0.033)
(+
0.5
(* (* x x) (+ -0.041666666666666664 (* (* x x) 0.001388888888888889))))
(/ (/ (- 1.0 (cos x)) x) x)))
double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
} else {
tmp = ((1.0 - cos(x)) / x) / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.033d0) then
tmp = 0.5d0 + ((x * x) * ((-0.041666666666666664d0) + ((x * x) * 0.001388888888888889d0)))
else
tmp = ((1.0d0 - cos(x)) / x) / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
} else {
tmp = ((1.0 - Math.cos(x)) / x) / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.033: tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889))) else: tmp = ((1.0 - math.cos(x)) / x) / x return tmp
function code(x) tmp = 0.0 if (x <= 0.033) tmp = Float64(0.5 + Float64(Float64(x * x) * Float64(-0.041666666666666664 + Float64(Float64(x * x) * 0.001388888888888889)))); else tmp = Float64(Float64(Float64(1.0 - cos(x)) / x) / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.033) tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889))); else tmp = ((1.0 - cos(x)) / x) / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.033], N[(0.5 + N[(N[(x * x), $MachinePrecision] * N[(-0.041666666666666664 + N[(N[(x * x), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.033:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\end{array}
\end{array}
if x < 0.033000000000000002Initial program 35.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6466.5%
Simplified66.5%
if 0.033000000000000002 < x Initial program 98.7%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6499.3%
Simplified99.3%
(FPCore (x)
:precision binary64
(if (<= x 0.033)
(+
0.5
(* (* x x) (+ -0.041666666666666664 (* (* x x) 0.001388888888888889))))
(/ (- 1.0 (cos x)) (* x x))))
double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
} else {
tmp = (1.0 - cos(x)) / (x * x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.033d0) then
tmp = 0.5d0 + ((x * x) * ((-0.041666666666666664d0) + ((x * x) * 0.001388888888888889d0)))
else
tmp = (1.0d0 - cos(x)) / (x * x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
} else {
tmp = (1.0 - Math.cos(x)) / (x * x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.033: tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889))) else: tmp = (1.0 - math.cos(x)) / (x * x) return tmp
function code(x) tmp = 0.0 if (x <= 0.033) tmp = Float64(0.5 + Float64(Float64(x * x) * Float64(-0.041666666666666664 + Float64(Float64(x * x) * 0.001388888888888889)))); else tmp = Float64(Float64(1.0 - cos(x)) / Float64(x * x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.033) tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889))); else tmp = (1.0 - cos(x)) / (x * x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.033], N[(0.5 + N[(N[(x * x), $MachinePrecision] * N[(-0.041666666666666664 + N[(N[(x * x), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.033:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos x}{x \cdot x}\\
\end{array}
\end{array}
if x < 0.033000000000000002Initial program 35.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6466.5%
Simplified66.5%
if 0.033000000000000002 < x Initial program 98.7%
(FPCore (x) :precision binary64 (if (<= x 3.2) (+ 0.5 (* (* x x) -0.041666666666666664)) (/ 6.0 (* x x))))
double code(double x) {
double tmp;
if (x <= 3.2) {
tmp = 0.5 + ((x * x) * -0.041666666666666664);
} else {
tmp = 6.0 / (x * x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 3.2d0) then
tmp = 0.5d0 + ((x * x) * (-0.041666666666666664d0))
else
tmp = 6.0d0 / (x * x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 3.2) {
tmp = 0.5 + ((x * x) * -0.041666666666666664);
} else {
tmp = 6.0 / (x * x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 3.2: tmp = 0.5 + ((x * x) * -0.041666666666666664) else: tmp = 6.0 / (x * x) return tmp
function code(x) tmp = 0.0 if (x <= 3.2) tmp = Float64(0.5 + Float64(Float64(x * x) * -0.041666666666666664)); else tmp = Float64(6.0 / Float64(x * x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 3.2) tmp = 0.5 + ((x * x) * -0.041666666666666664); else tmp = 6.0 / (x * x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 3.2], N[(0.5 + N[(N[(x * x), $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.2:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{x \cdot x}\\
\end{array}
\end{array}
if x < 3.2000000000000002Initial program 35.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6466.2%
Simplified66.2%
if 3.2000000000000002 < x Initial program 98.7%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6499.3%
Simplified99.3%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6499.2%
Applied egg-rr99.2%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6463.6%
Simplified63.6%
Taylor expanded in x around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6463.6%
Simplified63.6%
Final simplification65.6%
(FPCore (x) :precision binary64 (/ (/ x (+ 2.0 (* (* x x) 0.16666666666666666))) x))
double code(double x) {
return (x / (2.0 + ((x * x) * 0.16666666666666666))) / x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x / (2.0d0 + ((x * x) * 0.16666666666666666d0))) / x
end function
public static double code(double x) {
return (x / (2.0 + ((x * x) * 0.16666666666666666))) / x;
}
def code(x): return (x / (2.0 + ((x * x) * 0.16666666666666666))) / x
function code(x) return Float64(Float64(x / Float64(2.0 + Float64(Float64(x * x) * 0.16666666666666666))) / x) end
function tmp = code(x) tmp = (x / (2.0 + ((x * x) * 0.16666666666666666))) / x; end
code[x_] := N[(N[(x / N[(2.0 + N[(N[(x * x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x}{2 + \left(x \cdot x\right) \cdot 0.16666666666666666}}{x}
\end{array}
Initial program 50.4%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6451.5%
Simplified51.5%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6451.5%
Applied egg-rr51.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6476.9%
Simplified76.9%
/-lowering-/.f64N/A
clear-numN/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6477.1%
Applied egg-rr77.1%
(FPCore (x) :precision binary64 (/ (/ 1.0 (+ (* x 0.16666666666666666) (/ 2.0 x))) x))
double code(double x) {
return (1.0 / ((x * 0.16666666666666666) + (2.0 / x))) / x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / ((x * 0.16666666666666666d0) + (2.0d0 / x))) / x
end function
public static double code(double x) {
return (1.0 / ((x * 0.16666666666666666) + (2.0 / x))) / x;
}
def code(x): return (1.0 / ((x * 0.16666666666666666) + (2.0 / x))) / x
function code(x) return Float64(Float64(1.0 / Float64(Float64(x * 0.16666666666666666) + Float64(2.0 / x))) / x) end
function tmp = code(x) tmp = (1.0 / ((x * 0.16666666666666666) + (2.0 / x))) / x; end
code[x_] := N[(N[(1.0 / N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x \cdot 0.16666666666666666 + \frac{2}{x}}}{x}
\end{array}
Initial program 50.4%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6451.5%
Simplified51.5%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6451.5%
Applied egg-rr51.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6476.9%
Simplified76.9%
Taylor expanded in x around 0
metadata-evalN/A
fma-undefineN/A
lft-mult-inverseN/A
fma-defineN/A
associate-*l*N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
*-commutativeN/A
distribute-rgt-inN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*l*N/A
unpow2N/A
associate-/r*N/A
Simplified76.9%
(FPCore (x) :precision binary64 (if (<= x 3.4) 0.5 (/ 6.0 (* x x))))
double code(double x) {
double tmp;
if (x <= 3.4) {
tmp = 0.5;
} else {
tmp = 6.0 / (x * x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 3.4d0) then
tmp = 0.5d0
else
tmp = 6.0d0 / (x * x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 3.4) {
tmp = 0.5;
} else {
tmp = 6.0 / (x * x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 3.4: tmp = 0.5 else: tmp = 6.0 / (x * x) return tmp
function code(x) tmp = 0.0 if (x <= 3.4) tmp = 0.5; else tmp = Float64(6.0 / Float64(x * x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 3.4) tmp = 0.5; else tmp = 6.0 / (x * x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 3.4], 0.5, N[(6.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{x \cdot x}\\
\end{array}
\end{array}
if x < 3.39999999999999991Initial program 35.4%
Taylor expanded in x around 0
Simplified67.0%
if 3.39999999999999991 < x Initial program 98.7%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6499.3%
Simplified99.3%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6499.2%
Applied egg-rr99.2%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6463.6%
Simplified63.6%
Taylor expanded in x around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6463.6%
Simplified63.6%
(FPCore (x) :precision binary64 (if (<= x 1.65e+77) 0.5 0.0))
double code(double x) {
double tmp;
if (x <= 1.65e+77) {
tmp = 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.65d+77) then
tmp = 0.5d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.65e+77) {
tmp = 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.65e+77: tmp = 0.5 else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 1.65e+77) tmp = 0.5; else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.65e+77) tmp = 0.5; else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.65e+77], 0.5, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{+77}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.6499999999999999e77Initial program 40.4%
Taylor expanded in x around 0
Simplified62.2%
if 1.6499999999999999e77 < x Initial program 98.8%
div-subN/A
associate-/r*N/A
frac-subN/A
pow3N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
metadata-evalN/A
pow-prod-upN/A
unpow1N/A
pow2N/A
*-lowering-*.f64N/A
*-lowering-*.f647.7%
Applied egg-rr7.7%
Taylor expanded in x around 0
Simplified1.3%
Taylor expanded in x around 0
Simplified80.0%
(FPCore (x) :precision binary64 0.0)
double code(double x) {
return 0.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.0d0
end function
public static double code(double x) {
return 0.0;
}
def code(x): return 0.0
function code(x) return 0.0 end
function tmp = code(x) tmp = 0.0; end
code[x_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 50.4%
div-subN/A
associate-/r*N/A
frac-subN/A
pow3N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
metadata-evalN/A
pow-prod-upN/A
unpow1N/A
pow2N/A
*-lowering-*.f64N/A
*-lowering-*.f6421.4%
Applied egg-rr21.4%
Taylor expanded in x around 0
Simplified2.8%
Taylor expanded in x around 0
Simplified25.6%
herbie shell --seed 2024139
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))