
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
(FPCore (x y z a) :precision binary64 (+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (cbrt (pow (* (tan y) (tan z)) 3.0)))) (tan a))))
double code(double x, double y, double z, double a) {
return x + (((tan(y) + tan(z)) / (1.0 - cbrt(pow((tan(y) * tan(z)), 3.0)))) - tan(a));
}
public static double code(double x, double y, double z, double a) {
return x + (((Math.tan(y) + Math.tan(z)) / (1.0 - Math.cbrt(Math.pow((Math.tan(y) * Math.tan(z)), 3.0)))) - Math.tan(a));
}
function code(x, y, z, a) return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - cbrt((Float64(tan(y) * tan(z)) ^ 3.0)))) - tan(a))) end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[Power[N[Power[N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\frac{\tan y + \tan z}{1 - \sqrt[3]{{\left(\tan y \cdot \tan z\right)}^{3}}} - \tan a\right)
\end{array}
Initial program 80.9%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
add-cbrt-cube99.7%
pow399.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (cos (+ y z))) (t_1 (sin (+ y z))))
(if (<= a -2.5e-11)
(+ x (- (* t_1 (/ 1.0 t_0)) (tan a)))
(if (<= a 4.8e-91)
(fma (/ 1.0 (- 1.0 (* (tan y) (tan z)))) (+ (tan y) (tan z)) x)
(+ x (- (/ 1.0 (/ t_0 t_1)) (tan a)))))))
double code(double x, double y, double z, double a) {
double t_0 = cos((y + z));
double t_1 = sin((y + z));
double tmp;
if (a <= -2.5e-11) {
tmp = x + ((t_1 * (1.0 / t_0)) - tan(a));
} else if (a <= 4.8e-91) {
tmp = fma((1.0 / (1.0 - (tan(y) * tan(z)))), (tan(y) + tan(z)), x);
} else {
tmp = x + ((1.0 / (t_0 / t_1)) - tan(a));
}
return tmp;
}
function code(x, y, z, a) t_0 = cos(Float64(y + z)) t_1 = sin(Float64(y + z)) tmp = 0.0 if (a <= -2.5e-11) tmp = Float64(x + Float64(Float64(t_1 * Float64(1.0 / t_0)) - tan(a))); elseif (a <= 4.8e-91) tmp = fma(Float64(1.0 / Float64(1.0 - Float64(tan(y) * tan(z)))), Float64(tan(y) + tan(z)), x); else tmp = Float64(x + Float64(Float64(1.0 / Float64(t_0 / t_1)) - tan(a))); end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[a, -2.5e-11], N[(x + N[(N[(t$95$1 * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.8e-91], N[(N[(1.0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(1.0 / N[(t$95$0 / t$95$1), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y + z\right)\\
t_1 := \sin \left(y + z\right)\\
\mathbf{if}\;a \leq -2.5 \cdot 10^{-11}:\\
\;\;\;\;x + \left(t_1 \cdot \frac{1}{t_0} - \tan a\right)\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{-91}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{1 - \tan y \cdot \tan z}, \tan y + \tan z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\frac{1}{\frac{t_0}{t_1}} - \tan a\right)\\
\end{array}
\end{array}
if a < -2.50000000000000009e-11Initial program 85.1%
tan-quot85.1%
div-inv85.1%
Applied egg-rr85.1%
if -2.50000000000000009e-11 < a < 4.80000000000000022e-91Initial program 75.2%
+-commutative75.2%
associate-+l-75.2%
Applied egg-rr75.2%
Taylor expanded in a around 0 75.2%
neg-mul-175.2%
Simplified75.2%
tan-sum99.6%
rem-cbrt-cube99.6%
clear-num99.6%
rem-cbrt-cube99.6%
associate-/r/99.6%
fma-neg99.6%
add-sqr-sqrt0.0%
sqrt-unprod4.0%
sqr-neg4.0%
sqrt-unprod4.0%
add-sqr-sqrt4.0%
Applied egg-rr99.6%
if 4.80000000000000022e-91 < a Initial program 84.4%
tan-quot84.4%
clear-num84.4%
Applied egg-rr84.4%
Final simplification90.8%
(FPCore (x y z a) :precision binary64 (+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) (tan a))))
double code(double x, double y, double z, double a) {
return x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) - Math.tan(a));
}
def code(x, y, z, a): return x + (((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)
\end{array}
Initial program 80.9%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (cos (+ y z))) (t_1 (sin (+ y z))))
(if (<= a -1.8e-9)
(+ x (- (* t_1 (/ 1.0 t_0)) (tan a)))
(if (<= a 4.8e-91)
(+ x (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))))
(+ x (- (/ 1.0 (/ t_0 t_1)) (tan a)))))))
double code(double x, double y, double z, double a) {
double t_0 = cos((y + z));
double t_1 = sin((y + z));
double tmp;
if (a <= -1.8e-9) {
tmp = x + ((t_1 * (1.0 / t_0)) - tan(a));
} else if (a <= 4.8e-91) {
tmp = x + ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z))));
} else {
tmp = x + ((1.0 / (t_0 / t_1)) - tan(a));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((y + z))
t_1 = sin((y + z))
if (a <= (-1.8d-9)) then
tmp = x + ((t_1 * (1.0d0 / t_0)) - tan(a))
else if (a <= 4.8d-91) then
tmp = x + ((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z))))
else
tmp = x + ((1.0d0 / (t_0 / t_1)) - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double t_0 = Math.cos((y + z));
double t_1 = Math.sin((y + z));
double tmp;
if (a <= -1.8e-9) {
tmp = x + ((t_1 * (1.0 / t_0)) - Math.tan(a));
} else if (a <= 4.8e-91) {
tmp = x + ((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z))));
} else {
tmp = x + ((1.0 / (t_0 / t_1)) - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): t_0 = math.cos((y + z)) t_1 = math.sin((y + z)) tmp = 0 if a <= -1.8e-9: tmp = x + ((t_1 * (1.0 / t_0)) - math.tan(a)) elif a <= 4.8e-91: tmp = x + ((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) else: tmp = x + ((1.0 / (t_0 / t_1)) - math.tan(a)) return tmp
function code(x, y, z, a) t_0 = cos(Float64(y + z)) t_1 = sin(Float64(y + z)) tmp = 0.0 if (a <= -1.8e-9) tmp = Float64(x + Float64(Float64(t_1 * Float64(1.0 / t_0)) - tan(a))); elseif (a <= 4.8e-91) tmp = Float64(x + Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z))))); else tmp = Float64(x + Float64(Float64(1.0 / Float64(t_0 / t_1)) - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) t_0 = cos((y + z)); t_1 = sin((y + z)); tmp = 0.0; if (a <= -1.8e-9) tmp = x + ((t_1 * (1.0 / t_0)) - tan(a)); elseif (a <= 4.8e-91) tmp = x + ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))); else tmp = x + ((1.0 / (t_0 / t_1)) - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[a, -1.8e-9], N[(x + N[(N[(t$95$1 * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.8e-91], N[(x + N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 / N[(t$95$0 / t$95$1), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y + z\right)\\
t_1 := \sin \left(y + z\right)\\
\mathbf{if}\;a \leq -1.8 \cdot 10^{-9}:\\
\;\;\;\;x + \left(t_1 \cdot \frac{1}{t_0} - \tan a\right)\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{-91}:\\
\;\;\;\;x + \frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\frac{1}{\frac{t_0}{t_1}} - \tan a\right)\\
\end{array}
\end{array}
if a < -1.8e-9Initial program 85.1%
tan-quot85.1%
div-inv85.1%
Applied egg-rr85.1%
if -1.8e-9 < a < 4.80000000000000022e-91Initial program 75.2%
+-commutative75.2%
associate-+l-75.2%
Applied egg-rr75.2%
Taylor expanded in a around 0 75.2%
neg-mul-175.2%
Simplified75.2%
tan-sum99.6%
rem-cbrt-cube99.6%
div-inv99.6%
rem-cbrt-cube99.6%
fma-neg99.6%
add-sqr-sqrt0.0%
sqrt-unprod4.0%
sqr-neg4.0%
sqrt-unprod4.0%
add-sqr-sqrt4.0%
add-sqr-sqrt0.0%
sqrt-unprod99.6%
sqr-neg99.6%
Applied egg-rr99.6%
fma-udef99.6%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
if 4.80000000000000022e-91 < a Initial program 84.4%
tan-quot84.4%
clear-num84.4%
Applied egg-rr84.4%
Final simplification90.8%
(FPCore (x y z a) :precision binary64 (+ x (- (* (sin (+ y z)) (/ 1.0 (cos (+ y z)))) (tan a))))
double code(double x, double y, double z, double a) {
return x + ((sin((y + z)) * (1.0 / cos((y + z)))) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + ((sin((y + z)) * (1.0d0 / cos((y + z)))) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + ((Math.sin((y + z)) * (1.0 / Math.cos((y + z)))) - Math.tan(a));
}
def code(x, y, z, a): return x + ((math.sin((y + z)) * (1.0 / math.cos((y + z)))) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(Float64(sin(Float64(y + z)) * Float64(1.0 / cos(Float64(y + z)))) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + ((sin((y + z)) * (1.0 / cos((y + z)))) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\sin \left(y + z\right) \cdot \frac{1}{\cos \left(y + z\right)} - \tan a\right)
\end{array}
Initial program 80.9%
tan-quot80.9%
div-inv80.9%
Applied egg-rr80.9%
Final simplification80.9%
(FPCore (x y z a) :precision binary64 (if (or (<= a -0.05) (not (<= a 1.5e-6))) (- x (/ (sin a) (cos a))) (+ (tan (+ y z)) (- x a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -0.05) || !(a <= 1.5e-6)) {
tmp = x - (sin(a) / cos(a));
} else {
tmp = tan((y + z)) + (x - a);
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-0.05d0)) .or. (.not. (a <= 1.5d-6))) then
tmp = x - (sin(a) / cos(a))
else
tmp = tan((y + z)) + (x - a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -0.05) || !(a <= 1.5e-6)) {
tmp = x - (Math.sin(a) / Math.cos(a));
} else {
tmp = Math.tan((y + z)) + (x - a);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (a <= -0.05) or not (a <= 1.5e-6): tmp = x - (math.sin(a) / math.cos(a)) else: tmp = math.tan((y + z)) + (x - a) return tmp
function code(x, y, z, a) tmp = 0.0 if ((a <= -0.05) || !(a <= 1.5e-6)) tmp = Float64(x - Float64(sin(a) / cos(a))); else tmp = Float64(tan(Float64(y + z)) + Float64(x - a)); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((a <= -0.05) || ~((a <= 1.5e-6))) tmp = x - (sin(a) / cos(a)); else tmp = tan((y + z)) + (x - a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[Or[LessEqual[a, -0.05], N[Not[LessEqual[a, 1.5e-6]], $MachinePrecision]], N[(x - N[(N[Sin[a], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] + N[(x - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.05 \lor \neg \left(a \leq 1.5 \cdot 10^{-6}\right):\\
\;\;\;\;x - \frac{\sin a}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\tan \left(y + z\right) + \left(x - a\right)\\
\end{array}
\end{array}
if a < -0.050000000000000003 or 1.5e-6 < a Initial program 82.5%
tan-quot82.5%
div-inv82.5%
Applied egg-rr82.5%
Taylor expanded in z around 0 63.2%
Taylor expanded in y around 0 44.1%
if -0.050000000000000003 < a < 1.5e-6Initial program 79.0%
+-commutative79.0%
associate-+l-79.0%
Applied egg-rr79.0%
Taylor expanded in a around 0 79.0%
neg-mul-179.0%
unsub-neg79.0%
Simplified79.0%
Final simplification60.9%
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
Initial program 80.9%
Final simplification80.9%
(FPCore (x y z a) :precision binary64 (+ x (tan (+ y z))))
double code(double x, double y, double z, double a) {
return x + tan((y + z));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + tan((y + z))
end function
public static double code(double x, double y, double z, double a) {
return x + Math.tan((y + z));
}
def code(x, y, z, a): return x + math.tan((y + z))
function code(x, y, z, a) return Float64(x + tan(Float64(y + z))) end
function tmp = code(x, y, z, a) tmp = x + tan((y + z)); end
code[x_, y_, z_, a_] := N[(x + N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \tan \left(y + z\right)
\end{array}
Initial program 80.9%
+-commutative80.9%
associate-+l-80.8%
Applied egg-rr80.8%
Taylor expanded in a around 0 49.9%
neg-mul-149.9%
Simplified49.9%
sub-neg49.9%
add-sqr-sqrt0.0%
sqrt-unprod3.4%
sqr-neg3.4%
sqrt-unprod3.4%
add-sqr-sqrt3.4%
add-sqr-sqrt0.0%
sqrt-unprod49.9%
sqr-neg49.9%
sqrt-unprod49.7%
add-sqr-sqrt49.9%
Applied egg-rr49.9%
Final simplification49.9%
(FPCore (x y z a) :precision binary64 x)
double code(double x, double y, double z, double a) {
return x;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double a) {
return x;
}
def code(x, y, z, a): return x
function code(x, y, z, a) return x end
function tmp = code(x, y, z, a) tmp = x; end
code[x_, y_, z_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 80.9%
Taylor expanded in x around inf 31.1%
Final simplification31.1%
herbie shell --seed 2023318
(FPCore (x y z a)
:name "tan-example (used to crash)"
:precision binary64
:pre (and (and (and (or (== x 0.0) (and (<= 0.5884142 x) (<= x 505.5909))) (or (and (<= -1.796658e+308 y) (<= y -9.425585e-310)) (and (<= 1.284938e-309 y) (<= y 1.751224e+308)))) (or (and (<= -1.776707e+308 z) (<= z -8.599796e-310)) (and (<= 3.293145e-311 z) (<= z 1.725154e+308)))) (or (and (<= -1.796658e+308 a) (<= a -9.425585e-310)) (and (<= 1.284938e-309 a) (<= a 1.751224e+308))))
(+ x (- (tan (+ y z)) (tan a))))