
(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) x) (tan (/ x 2.0))))
double code(double x) {
return ((sin(x) / x) / x) * tan((x / 2.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((sin(x) / x) / x) * tan((x / 2.0d0))
end function
public static double code(double x) {
return ((Math.sin(x) / x) / x) * Math.tan((x / 2.0));
}
def code(x): return ((math.sin(x) / x) / x) * math.tan((x / 2.0))
function code(x) return Float64(Float64(Float64(sin(x) / x) / x) * tan(Float64(x / 2.0))) end
function tmp = code(x) tmp = ((sin(x) / x) / x) * tan((x / 2.0)); end
code[x_] := N[(N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision] * N[Tan[N[(x / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\sin x}{x}}{x} \cdot \tan \left(\frac{x}{2}\right)
\end{array}
Initial program 50.2%
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.2%
Applied egg-rr76.2%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
(FPCore (x)
:precision binary64
(if (<= x 0.032)
(+
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.032) {
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.032d0) 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.032) {
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.032: 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.032) 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.032) 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.032], 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.032:\\
\;\;\;\;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.032000000000000001Initial program 34.2%
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-*.f6468.2%
Simplified68.2%
if 0.032000000000000001 < x Initial program 98.3%
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
cos-lowering-cos.f6498.1%
Applied egg-rr98.1%
associate-/r*N/A
sub-divN/A
div-invN/A
fmm-defN/A
clear-numN/A
associate-/r/N/A
/-lowering-/.f64N/A
associate-/r/N/A
clear-numN/A
fmm-defN/A
div-invN/A
sub-divN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f6499.1%
Applied egg-rr99.1%
(FPCore (x)
:precision binary64
(if (<= x 0.032)
(+
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.032) {
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.032d0) 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.032) {
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.032: 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.032) 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.032) 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.032], 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.032:\\
\;\;\;\;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.032000000000000001Initial program 34.2%
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-*.f6468.2%
Simplified68.2%
if 0.032000000000000001 < x Initial program 98.3%
(FPCore (x)
:precision binary64
(if (<= x 4.2)
(+
0.5
(*
(* x x)
(+
-0.041666666666666664
(* x (* x (+ 0.001388888888888889 (* (* x x) -2.48015873015873e-5)))))))
(/ (/ 2.0 x) x)))
double code(double x) {
double tmp;
if (x <= 4.2) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + (x * (x * (0.001388888888888889 + ((x * x) * -2.48015873015873e-5))))));
} else {
tmp = (2.0 / x) / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 4.2d0) then
tmp = 0.5d0 + ((x * x) * ((-0.041666666666666664d0) + (x * (x * (0.001388888888888889d0 + ((x * x) * (-2.48015873015873d-5)))))))
else
tmp = (2.0d0 / x) / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 4.2) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + (x * (x * (0.001388888888888889 + ((x * x) * -2.48015873015873e-5))))));
} else {
tmp = (2.0 / x) / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 4.2: tmp = 0.5 + ((x * x) * (-0.041666666666666664 + (x * (x * (0.001388888888888889 + ((x * x) * -2.48015873015873e-5)))))) else: tmp = (2.0 / x) / x return tmp
function code(x) tmp = 0.0 if (x <= 4.2) tmp = Float64(0.5 + Float64(Float64(x * x) * Float64(-0.041666666666666664 + Float64(x * Float64(x * Float64(0.001388888888888889 + Float64(Float64(x * x) * -2.48015873015873e-5))))))); else tmp = Float64(Float64(2.0 / x) / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 4.2) tmp = 0.5 + ((x * x) * (-0.041666666666666664 + (x * (x * (0.001388888888888889 + ((x * x) * -2.48015873015873e-5)))))); else tmp = (2.0 / x) / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 4.2], N[(0.5 + N[(N[(x * x), $MachinePrecision] * N[(-0.041666666666666664 + N[(x * N[(x * N[(0.001388888888888889 + N[(N[(x * x), $MachinePrecision] * -2.48015873015873e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / x), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.2:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + x \cdot \left(x \cdot \left(0.001388888888888889 + \left(x \cdot x\right) \cdot -2.48015873015873 \cdot 10^{-5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{x}}{x}\\
\end{array}
\end{array}
if x < 4.20000000000000018Initial program 34.6%
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
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.9%
Simplified67.9%
if 4.20000000000000018 < x Initial program 98.3%
Applied egg-rr58.5%
Taylor expanded in x around 0
/-lowering-/.f6460.0%
Simplified60.0%
(FPCore (x)
:precision binary64
(if (<= x 2.7)
(+
0.5
(* (* x x) (+ -0.041666666666666664 (* (* x x) 0.001388888888888889))))
(/ (/ 2.0 x) x)))
double code(double x) {
double tmp;
if (x <= 2.7) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
} else {
tmp = (2.0 / x) / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 2.7d0) then
tmp = 0.5d0 + ((x * x) * ((-0.041666666666666664d0) + ((x * x) * 0.001388888888888889d0)))
else
tmp = (2.0d0 / x) / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 2.7) {
tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
} else {
tmp = (2.0 / x) / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.7: tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889))) else: tmp = (2.0 / x) / x return tmp
function code(x) tmp = 0.0 if (x <= 2.7) tmp = Float64(0.5 + Float64(Float64(x * x) * Float64(-0.041666666666666664 + Float64(Float64(x * x) * 0.001388888888888889)))); else tmp = Float64(Float64(2.0 / x) / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.7) tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889))); else tmp = (2.0 / x) / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.7], N[(0.5 + N[(N[(x * x), $MachinePrecision] * N[(-0.041666666666666664 + N[(N[(x * x), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / x), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{x}}{x}\\
\end{array}
\end{array}
if x < 2.7000000000000002Initial program 34.6%
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-*.f6468.1%
Simplified68.1%
if 2.7000000000000002 < x Initial program 98.3%
Applied egg-rr58.5%
Taylor expanded in x around 0
/-lowering-/.f6460.0%
Simplified60.0%
(FPCore (x) :precision binary64 (if (<= x 2.4) (+ 0.5 (* (* x x) -0.041666666666666664)) (/ (/ 2.0 x) x)))
double code(double x) {
double tmp;
if (x <= 2.4) {
tmp = 0.5 + ((x * x) * -0.041666666666666664);
} else {
tmp = (2.0 / x) / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 2.4d0) then
tmp = 0.5d0 + ((x * x) * (-0.041666666666666664d0))
else
tmp = (2.0d0 / x) / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 2.4) {
tmp = 0.5 + ((x * x) * -0.041666666666666664);
} else {
tmp = (2.0 / x) / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.4: tmp = 0.5 + ((x * x) * -0.041666666666666664) else: tmp = (2.0 / x) / x return tmp
function code(x) tmp = 0.0 if (x <= 2.4) tmp = Float64(0.5 + Float64(Float64(x * x) * -0.041666666666666664)); else tmp = Float64(Float64(2.0 / x) / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.4) tmp = 0.5 + ((x * x) * -0.041666666666666664); else tmp = (2.0 / x) / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.4], N[(0.5 + N[(N[(x * x), $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / x), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.4:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{x}}{x}\\
\end{array}
\end{array}
if x < 2.39999999999999991Initial program 34.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.7%
Simplified67.7%
if 2.39999999999999991 < x Initial program 98.3%
Applied egg-rr58.5%
Taylor expanded in x around 0
/-lowering-/.f6460.0%
Simplified60.0%
Final simplification65.8%
(FPCore (x) :precision binary64 (if (<= x 2.0) 0.5 (/ (/ 2.0 x) x)))
double code(double x) {
double tmp;
if (x <= 2.0) {
tmp = 0.5;
} else {
tmp = (2.0 / x) / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 2.0d0) then
tmp = 0.5d0
else
tmp = (2.0d0 / x) / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 2.0) {
tmp = 0.5;
} else {
tmp = (2.0 / x) / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.0: tmp = 0.5 else: tmp = (2.0 / x) / x return tmp
function code(x) tmp = 0.0 if (x <= 2.0) tmp = 0.5; else tmp = Float64(Float64(2.0 / x) / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.0) tmp = 0.5; else tmp = (2.0 / x) / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.0], 0.5, N[(N[(2.0 / x), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{x}}{x}\\
\end{array}
\end{array}
if x < 2Initial program 34.6%
Taylor expanded in x around 0
Simplified68.1%
if 2 < x Initial program 98.3%
Applied egg-rr58.5%
Taylor expanded in x around 0
/-lowering-/.f6460.0%
Simplified60.0%
(FPCore (x) :precision binary64 (if (<= x 2.0) 0.5 (/ 2.0 (* x x))))
double code(double x) {
double tmp;
if (x <= 2.0) {
tmp = 0.5;
} else {
tmp = 2.0 / (x * x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 2.0d0) then
tmp = 0.5d0
else
tmp = 2.0d0 / (x * x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 2.0) {
tmp = 0.5;
} else {
tmp = 2.0 / (x * x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.0: tmp = 0.5 else: tmp = 2.0 / (x * x) return tmp
function code(x) tmp = 0.0 if (x <= 2.0) tmp = 0.5; else tmp = Float64(2.0 / Float64(x * x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.0) tmp = 0.5; else tmp = 2.0 / (x * x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.0], 0.5, N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{x \cdot x}\\
\end{array}
\end{array}
if x < 2Initial program 34.6%
Taylor expanded in x around 0
Simplified68.1%
if 2 < x Initial program 98.3%
Applied egg-rr58.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6459.9%
Simplified59.9%
(FPCore (x) :precision binary64 (if (<= x 8e+76) 0.5 0.0))
double code(double x) {
double tmp;
if (x <= 8e+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 <= 8d+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 <= 8e+76) {
tmp = 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 8e+76: tmp = 0.5 else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 8e+76) tmp = 0.5; else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 8e+76) tmp = 0.5; else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 8e+76], 0.5, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{+76}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 8.0000000000000004e76Initial program 39.2%
Taylor expanded in x around 0
Simplified63.7%
if 8.0000000000000004e76 < x Initial program 98.1%
Taylor expanded in x around 0
Simplified68.0%
metadata-evalN/A
div068.0%
Applied egg-rr68.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.2%
Taylor expanded in x around 0
Simplified24.7%
metadata-evalN/A
div025.4%
Applied egg-rr25.4%
herbie shell --seed 2024161
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))