
(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 11 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 0.5))) x))
double code(double x) {
return ((sin(x) / x) * tan((x * 0.5))) / x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((sin(x) / x) * tan((x * 0.5d0))) / x
end function
public static double code(double x) {
return ((Math.sin(x) / x) * Math.tan((x * 0.5))) / x;
}
def code(x): return ((math.sin(x) / x) * math.tan((x * 0.5))) / x
function code(x) return Float64(Float64(Float64(sin(x) / x) * tan(Float64(x * 0.5))) / x) end
function tmp = code(x) tmp = ((sin(x) / x) * tan((x * 0.5))) / x; end
code[x_] := N[(N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * N[Tan[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\sin x}{x} \cdot \tan \left(x \cdot 0.5\right)}{x}
\end{array}
Initial program 53.1%
lift-cos.f64N/A
flip--N/A
lift-*.f64N/A
associate-/l/N/A
metadata-evalN/A
lift-cos.f64N/A
lift-cos.f64N/A
1-sub-cosN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lift-cos.f64N/A
hang-0p-tanN/A
lower-tan.f64N/A
lower-/.f6481.3
Applied rewrites81.3%
lift-sin.f64N/A
lift-*.f64N/A
frac-2negN/A
lift-/.f64N/A
lift-tan.f64N/A
frac-2negN/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6499.8
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval99.8
Applied rewrites99.8%
(FPCore (x) :precision binary64 (if (<= x 0.033) (fma (* x x) (fma (* x x) 0.001388888888888889 -0.041666666666666664) 0.5) (/ (* (/ 1.0 x) (- 1.0 (cos x))) x)))
double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = fma((x * x), fma((x * x), 0.001388888888888889, -0.041666666666666664), 0.5);
} else {
tmp = ((1.0 / x) * (1.0 - cos(x))) / x;
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.033) tmp = fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, -0.041666666666666664), 0.5); else tmp = Float64(Float64(Float64(1.0 / x) * Float64(1.0 - cos(x))) / x); end return tmp end
code[x_] := If[LessEqual[x, 0.033], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + -0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] * N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.033:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, -0.041666666666666664\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} \cdot \left(1 - \cos x\right)}{x}\\
\end{array}
\end{array}
if x < 0.033000000000000002Initial program 36.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.9
Applied rewrites65.9%
if 0.033000000000000002 < x Initial program 98.8%
Applied rewrites98.8%
lift-*.f64N/A
lift-cos.f64N/A
lift-+.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
sub-negN/A
lower--.f64N/A
metadata-eval99.4
Applied rewrites99.4%
lift-cos.f64N/A
lift--.f64N/A
div-invN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6499.4
Applied rewrites99.4%
(FPCore (x) :precision binary64 (if (<= x 0.033) (fma (* x x) (fma (* x x) 0.001388888888888889 -0.041666666666666664) 0.5) (* (/ (/ -1.0 x) x) (+ (cos x) -1.0))))
double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = fma((x * x), fma((x * x), 0.001388888888888889, -0.041666666666666664), 0.5);
} else {
tmp = ((-1.0 / x) / x) * (cos(x) + -1.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.033) tmp = fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, -0.041666666666666664), 0.5); else tmp = Float64(Float64(Float64(-1.0 / x) / x) * Float64(cos(x) + -1.0)); end return tmp end
code[x_] := If[LessEqual[x, 0.033], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + -0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision], N[(N[(N[(-1.0 / x), $MachinePrecision] / x), $MachinePrecision] * N[(N[Cos[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.033:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, -0.041666666666666664\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{x}}{x} \cdot \left(\cos x + -1\right)\\
\end{array}
\end{array}
if x < 0.033000000000000002Initial program 36.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.9
Applied rewrites65.9%
if 0.033000000000000002 < x Initial program 98.8%
Applied rewrites98.8%
associate-/r*N/A
lift-/.f64N/A
lower-/.f6499.4
Applied rewrites99.4%
(FPCore (x) :precision binary64 (if (<= x 0.033) (fma (* x x) (fma (* x x) 0.001388888888888889 -0.041666666666666664) 0.5) (/ (/ (- 1.0 (cos x)) x) x)))
double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = fma((x * x), fma((x * x), 0.001388888888888889, -0.041666666666666664), 0.5);
} else {
tmp = ((1.0 - cos(x)) / x) / x;
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.033) tmp = fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, -0.041666666666666664), 0.5); else tmp = Float64(Float64(Float64(1.0 - cos(x)) / x) / x); end return tmp end
code[x_] := If[LessEqual[x, 0.033], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + -0.041666666666666664), $MachinePrecision] + 0.5), $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:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, -0.041666666666666664\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\end{array}
\end{array}
if x < 0.033000000000000002Initial program 36.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.9
Applied rewrites65.9%
if 0.033000000000000002 < x Initial program 98.8%
Applied rewrites98.8%
lift-*.f64N/A
lift-cos.f64N/A
lift-+.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
sub-negN/A
lower--.f64N/A
metadata-eval99.4
Applied rewrites99.4%
(FPCore (x) :precision binary64 (if (<= x 0.033) (fma (* x x) (fma (* x x) 0.001388888888888889 -0.041666666666666664) 0.5) (/ (- 1.0 (cos x)) (* x x))))
double code(double x) {
double tmp;
if (x <= 0.033) {
tmp = fma((x * x), fma((x * x), 0.001388888888888889, -0.041666666666666664), 0.5);
} else {
tmp = (1.0 - cos(x)) / (x * x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.033) tmp = fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, -0.041666666666666664), 0.5); else tmp = Float64(Float64(1.0 - cos(x)) / Float64(x * x)); end return tmp end
code[x_] := If[LessEqual[x, 0.033], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + -0.041666666666666664), $MachinePrecision] + 0.5), $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:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, -0.041666666666666664\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos x}{x \cdot x}\\
\end{array}
\end{array}
if x < 0.033000000000000002Initial program 36.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.9
Applied rewrites65.9%
if 0.033000000000000002 < x Initial program 98.8%
(FPCore (x) :precision binary64 (if (<= x 700000.0) (fma (* x x) (fma (* x x) 0.001388888888888889 -0.041666666666666664) 0.5) (/ (fma (/ 1.0 x) x (* x (/ -1.0 x))) (* x x))))
double code(double x) {
double tmp;
if (x <= 700000.0) {
tmp = fma((x * x), fma((x * x), 0.001388888888888889, -0.041666666666666664), 0.5);
} else {
tmp = fma((1.0 / x), x, (x * (-1.0 / x))) / (x * x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 700000.0) tmp = fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, -0.041666666666666664), 0.5); else tmp = Float64(fma(Float64(1.0 / x), x, Float64(x * Float64(-1.0 / x))) / Float64(x * x)); end return tmp end
code[x_] := If[LessEqual[x, 700000.0], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + -0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] * x + N[(x * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 700000:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, -0.041666666666666664\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{1}{x}, x, x \cdot \frac{-1}{x}\right)}{x \cdot x}\\
\end{array}
\end{array}
if x < 7e5Initial program 36.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.6
Applied rewrites65.6%
if 7e5 < x Initial program 98.8%
Applied rewrites98.8%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
distribute-lft-inN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
Applied rewrites50.4%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-addN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites51.2%
(FPCore (x) :precision binary64 (if (<= x 1.4e+22) (fma (* x x) (fma (* x x) 0.001388888888888889 -0.041666666666666664) 0.5) (fma (/ 1.0 x) (/ 1.0 x) (/ -1.0 (* x x)))))
double code(double x) {
double tmp;
if (x <= 1.4e+22) {
tmp = fma((x * x), fma((x * x), 0.001388888888888889, -0.041666666666666664), 0.5);
} else {
tmp = fma((1.0 / x), (1.0 / x), (-1.0 / (x * x)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.4e+22) tmp = fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, -0.041666666666666664), 0.5); else tmp = fma(Float64(1.0 / x), Float64(1.0 / x), Float64(-1.0 / Float64(x * x))); end return tmp end
code[x_] := If[LessEqual[x, 1.4e+22], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + -0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision] + N[(-1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, -0.041666666666666664\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{x}, \frac{1}{x}, \frac{-1}{x \cdot x}\right)\\
\end{array}
\end{array}
if x < 1.4e22Initial program 37.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.6
Applied rewrites64.6%
if 1.4e22 < x Initial program 98.8%
Applied rewrites98.8%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
distribute-lft-inN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
Applied rewrites52.3%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
lift-*.f64N/A
lower-/.f6453.0
Applied rewrites53.0%
(FPCore (x) :precision binary64 (if (<= x 4.8e+14) (fma (* x x) (fma (* x x) 0.001388888888888889 -0.041666666666666664) 0.5) (fma (/ 1.0 x) (/ -1.0 x) (/ 1.0 (* x x)))))
double code(double x) {
double tmp;
if (x <= 4.8e+14) {
tmp = fma((x * x), fma((x * x), 0.001388888888888889, -0.041666666666666664), 0.5);
} else {
tmp = fma((1.0 / x), (-1.0 / x), (1.0 / (x * x)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 4.8e+14) tmp = fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, -0.041666666666666664), 0.5); else tmp = fma(Float64(1.0 / x), Float64(-1.0 / x), Float64(1.0 / Float64(x * x))); end return tmp end
code[x_] := If[LessEqual[x, 4.8e+14], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + -0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] * N[(-1.0 / x), $MachinePrecision] + N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.8 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, -0.041666666666666664\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{x}, \frac{-1}{x}, \frac{1}{x \cdot x}\right)\\
\end{array}
\end{array}
if x < 4.8e14Initial program 36.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.6
Applied rewrites65.6%
if 4.8e14 < x Initial program 98.8%
Applied rewrites98.8%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
distribute-lft-inN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
Applied rewrites50.4%
(FPCore (x) :precision binary64 (if (<= x 4.6e+38) (fma (* x x) (fma (* x x) 0.001388888888888889 -0.041666666666666664) 0.5) 0.0))
double code(double x) {
double tmp;
if (x <= 4.6e+38) {
tmp = fma((x * x), fma((x * x), 0.001388888888888889, -0.041666666666666664), 0.5);
} else {
tmp = 0.0;
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 4.6e+38) tmp = fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, -0.041666666666666664), 0.5); else tmp = 0.0; end return tmp end
code[x_] := If[LessEqual[x, 4.6e+38], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + -0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, -0.041666666666666664\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.6000000000000002e38Initial program 39.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.8
Applied rewrites62.8%
if 4.6000000000000002e38 < x Initial program 98.7%
Taylor expanded in x around 0
Applied rewrites57.2%
metadata-evalN/A
lift-*.f64N/A
div057.2
Applied rewrites57.2%
(FPCore (x) :precision binary64 (if (<= x 8.5e+76) 0.5 0.0))
double code(double x) {
double tmp;
if (x <= 8.5e+76) {
tmp = 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 8.5d+76) then
tmp = 0.5d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 8.5e+76) {
tmp = 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 8.5e+76: tmp = 0.5 else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 8.5e+76) tmp = 0.5; else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 8.5e+76) tmp = 0.5; else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 8.5e+76], 0.5, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{+76}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 8.49999999999999992e76Initial program 41.4%
Taylor expanded in x around 0
Applied rewrites61.4%
if 8.49999999999999992e76 < x Initial program 98.8%
Taylor expanded in x around 0
Applied rewrites63.3%
metadata-evalN/A
lift-*.f64N/A
div063.3
Applied rewrites63.3%
(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 53.1%
Taylor expanded in x around 0
Applied rewrites24.8%
metadata-evalN/A
lift-*.f64N/A
div025.4
Applied rewrites25.4%
herbie shell --seed 2024216
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))