
(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 11 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 (+ -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 / (-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) / ((-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 / (-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 / (-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(-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 / (-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[(-1.0 + N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(\tan y + \tan z\right) \cdot \frac{-1}{-1 + \tan y \cdot \tan z} - \tan a\right)
\end{array}
Initial program 77.7%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ (tan y) (tan z))))
(if (or (<= (tan a) -4e-13) (not (<= (tan a) 5e-13)))
(fma 1.0 t_0 (- x (tan a)))
(+ x (* t_0 (/ -1.0 (+ -1.0 (* (tan y) (tan z)))))))))
double code(double x, double y, double z, double a) {
double t_0 = tan(y) + tan(z);
double tmp;
if ((tan(a) <= -4e-13) || !(tan(a) <= 5e-13)) {
tmp = fma(1.0, t_0, (x - tan(a)));
} else {
tmp = x + (t_0 * (-1.0 / (-1.0 + (tan(y) * tan(z)))));
}
return tmp;
}
function code(x, y, z, a) t_0 = Float64(tan(y) + tan(z)) tmp = 0.0 if ((tan(a) <= -4e-13) || !(tan(a) <= 5e-13)) tmp = fma(1.0, t_0, Float64(x - tan(a))); else tmp = Float64(x + Float64(t_0 * Float64(-1.0 / Float64(-1.0 + Float64(tan(y) * tan(z)))))); end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[Tan[a], $MachinePrecision], -4e-13], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 5e-13]], $MachinePrecision]], N[(1.0 * t$95$0 + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$0 * N[(-1.0 / N[(-1.0 + N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;\tan a \leq -4 \cdot 10^{-13} \lor \neg \left(\tan a \leq 5 \cdot 10^{-13}\right):\\
\;\;\;\;\mathsf{fma}\left(1, t\_0, x - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_0 \cdot \frac{-1}{-1 + \tan y \cdot \tan z}\\
\end{array}
\end{array}
if (tan.f64 a) < -4.0000000000000001e-13 or 4.9999999999999999e-13 < (tan.f64 a) Initial program 75.5%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
+-commutative99.7%
associate-+l-99.6%
*-commutative99.6%
fma-neg99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 76.0%
if -4.0000000000000001e-13 < (tan.f64 a) < 4.9999999999999999e-13Initial program 80.1%
+-commutative80.1%
associate-+l-80.1%
Applied egg-rr80.1%
Taylor expanded in a around 0 80.1%
neg-mul-180.1%
Simplified80.1%
tan-sum99.8%
div-inv99.8%
Applied egg-rr99.7%
Final simplification87.4%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ (tan y) (tan z))))
(if (or (<= (tan a) -4e-13) (not (<= (tan a) 5e-13)))
(fma 1.0 t_0 (- x (tan a)))
(- x (/ t_0 (+ -1.0 (* (tan y) (tan z))))))))
double code(double x, double y, double z, double a) {
double t_0 = tan(y) + tan(z);
double tmp;
if ((tan(a) <= -4e-13) || !(tan(a) <= 5e-13)) {
tmp = fma(1.0, t_0, (x - tan(a)));
} else {
tmp = x - (t_0 / (-1.0 + (tan(y) * tan(z))));
}
return tmp;
}
function code(x, y, z, a) t_0 = Float64(tan(y) + tan(z)) tmp = 0.0 if ((tan(a) <= -4e-13) || !(tan(a) <= 5e-13)) tmp = fma(1.0, t_0, Float64(x - tan(a))); else tmp = Float64(x - Float64(t_0 / Float64(-1.0 + Float64(tan(y) * tan(z))))); end return tmp end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[Tan[a], $MachinePrecision], -4e-13], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 5e-13]], $MachinePrecision]], N[(1.0 * t$95$0 + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t$95$0 / N[(-1.0 + N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;\tan a \leq -4 \cdot 10^{-13} \lor \neg \left(\tan a \leq 5 \cdot 10^{-13}\right):\\
\;\;\;\;\mathsf{fma}\left(1, t\_0, x - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{t\_0}{-1 + \tan y \cdot \tan z}\\
\end{array}
\end{array}
if (tan.f64 a) < -4.0000000000000001e-13 or 4.9999999999999999e-13 < (tan.f64 a) Initial program 75.5%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
+-commutative99.7%
associate-+l-99.6%
*-commutative99.6%
fma-neg99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 76.0%
if -4.0000000000000001e-13 < (tan.f64 a) < 4.9999999999999999e-13Initial program 80.1%
+-commutative80.1%
associate-+l-80.1%
Applied egg-rr80.1%
Taylor expanded in a around 0 80.1%
neg-mul-180.1%
Simplified80.1%
tan-sum99.8%
div-inv99.8%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification87.4%
(FPCore (x y z a) :precision binary64 (- x (+ (tan a) (/ (+ (tan y) (tan z)) (+ -1.0 (* (tan y) (tan z)))))))
double code(double x, double y, double z, double a) {
return x - (tan(a) + ((tan(y) + tan(z)) / (-1.0 + (tan(y) * tan(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(a) + ((tan(y) + tan(z)) / ((-1.0d0) + (tan(y) * tan(z)))))
end function
public static double code(double x, double y, double z, double a) {
return x - (Math.tan(a) + ((Math.tan(y) + Math.tan(z)) / (-1.0 + (Math.tan(y) * Math.tan(z)))));
}
def code(x, y, z, a): return x - (math.tan(a) + ((math.tan(y) + math.tan(z)) / (-1.0 + (math.tan(y) * math.tan(z)))))
function code(x, y, z, a) return Float64(x - Float64(tan(a) + Float64(Float64(tan(y) + tan(z)) / Float64(-1.0 + Float64(tan(y) * tan(z)))))) end
function tmp = code(x, y, z, a) tmp = x - (tan(a) + ((tan(y) + tan(z)) / (-1.0 + (tan(y) * tan(z))))); end
code[x_, y_, z_, a_] := N[(x - N[(N[Tan[a], $MachinePrecision] + 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]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(\tan a + \frac{\tan y + \tan z}{-1 + \tan y \cdot \tan z}\right)
\end{array}
Initial program 77.7%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/60.8%
*-rgt-identity60.8%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z a) :precision binary64 (fma 1.0 (+ (tan y) (tan z)) (- x (tan a))))
double code(double x, double y, double z, double a) {
return fma(1.0, (tan(y) + tan(z)), (x - tan(a)));
}
function code(x, y, z, a) return fma(1.0, Float64(tan(y) + tan(z)), Float64(x - tan(a))) end
code[x_, y_, z_, a_] := N[(1.0 * N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1, \tan y + \tan z, x - \tan a\right)
\end{array}
Initial program 77.7%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
+-commutative99.7%
associate-+l-99.7%
*-commutative99.7%
fma-neg99.6%
Applied egg-rr99.6%
Taylor expanded in y around 0 77.9%
Final simplification77.9%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -2e-9) (+ x (tan (+ y z))) (+ (tan z) (- x (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -2e-9) {
tmp = x + tan((y + z));
} else {
tmp = tan(z) + (x - 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) :: tmp
if ((y + z) <= (-2d-9)) then
tmp = x + tan((y + z))
else
tmp = tan(z) + (x - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -2e-9) {
tmp = x + Math.tan((y + z));
} else {
tmp = Math.tan(z) + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= -2e-9: tmp = x + math.tan((y + z)) else: tmp = math.tan(z) + (x - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= -2e-9) tmp = Float64(x + tan(Float64(y + z))); else tmp = Float64(tan(z) + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= -2e-9) tmp = x + tan((y + z)); else tmp = tan(z) + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -2e-9], N[(x + N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Tan[z], $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -2 \cdot 10^{-9}:\\
\;\;\;\;x + \tan \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;\tan z + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -2.00000000000000012e-9Initial program 74.4%
+-commutative74.4%
associate-+l-74.2%
Applied egg-rr74.2%
Taylor expanded in a around 0 47.4%
neg-mul-147.4%
Simplified47.4%
sub-neg47.4%
+-commutative47.4%
add-sqr-sqrt0.0%
sqrt-unprod3.9%
sqr-neg3.9%
sqrt-unprod3.9%
add-sqr-sqrt3.9%
add-sqr-sqrt0.0%
sqrt-unprod47.4%
sqr-neg47.4%
sqrt-unprod47.2%
add-sqr-sqrt47.4%
Applied egg-rr47.4%
if -2.00000000000000012e-9 < (+.f64 y z) Initial program 79.8%
Taylor expanded in y around 0 66.3%
+-commutative66.3%
associate--l+66.4%
Simplified66.4%
tan-quot66.4%
tan-quot66.4%
associate-+r-66.4%
Applied egg-rr66.4%
associate-+r-66.4%
Simplified66.4%
Final simplification59.2%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -5e-11) (+ x (- (tan y) (tan a))) (+ (tan z) (- x (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -5e-11) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = tan(z) + (x - 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) :: tmp
if ((y + z) <= (-5d-11)) then
tmp = x + (tan(y) - tan(a))
else
tmp = tan(z) + (x - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -5e-11) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = Math.tan(z) + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= -5e-11: tmp = x + (math.tan(y) - math.tan(a)) else: tmp = math.tan(z) + (x - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= -5e-11) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(tan(z) + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= -5e-11) tmp = x + (tan(y) - tan(a)); else tmp = tan(z) + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -5e-11], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Tan[z], $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -5 \cdot 10^{-11}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;\tan z + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -5.00000000000000018e-11Initial program 74.6%
+-commutative74.6%
associate-+l-74.5%
Applied egg-rr74.5%
Taylor expanded in z around 0 48.1%
tan-quot48.2%
associate--r-48.3%
Applied egg-rr48.3%
if -5.00000000000000018e-11 < (+.f64 y z) Initial program 79.7%
Taylor expanded in y around 0 66.3%
+-commutative66.3%
associate--l+66.3%
Simplified66.3%
tan-quot66.3%
tan-quot66.3%
associate-+r-66.3%
Applied egg-rr66.3%
associate-+r-66.3%
Simplified66.3%
Final simplification59.4%
(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 77.7%
Final simplification77.7%
(FPCore (x y z a) :precision binary64 (if (or (<= (+ y z) -2000.0) (not (<= (+ y z) 4e-12))) (+ x (tan (+ y z))) (+ y (- x (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if (((y + z) <= -2000.0) || !((y + z) <= 4e-12)) {
tmp = x + tan((y + z));
} else {
tmp = y + (x - 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) :: tmp
if (((y + z) <= (-2000.0d0)) .or. (.not. ((y + z) <= 4d-12))) then
tmp = x + tan((y + z))
else
tmp = y + (x - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (((y + z) <= -2000.0) || !((y + z) <= 4e-12)) {
tmp = x + Math.tan((y + z));
} else {
tmp = y + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if ((y + z) <= -2000.0) or not ((y + z) <= 4e-12): tmp = x + math.tan((y + z)) else: tmp = y + (x - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if ((Float64(y + z) <= -2000.0) || !(Float64(y + z) <= 4e-12)) tmp = Float64(x + tan(Float64(y + z))); else tmp = Float64(y + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (((y + z) <= -2000.0) || ~(((y + z) <= 4e-12))) tmp = x + tan((y + z)); else tmp = y + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[Or[LessEqual[N[(y + z), $MachinePrecision], -2000.0], N[Not[LessEqual[N[(y + z), $MachinePrecision], 4e-12]], $MachinePrecision]], N[(x + N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(y + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -2000 \lor \neg \left(y + z \leq 4 \cdot 10^{-12}\right):\\
\;\;\;\;x + \tan \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;y + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -2e3 or 3.99999999999999992e-12 < (+.f64 y z) Initial program 69.9%
+-commutative69.9%
associate-+l-69.8%
Applied egg-rr69.8%
Taylor expanded in a around 0 47.1%
neg-mul-147.1%
Simplified47.1%
sub-neg47.1%
+-commutative47.1%
add-sqr-sqrt0.0%
sqrt-unprod4.1%
sqr-neg4.1%
sqrt-unprod4.1%
add-sqr-sqrt4.1%
add-sqr-sqrt0.0%
sqrt-unprod47.1%
sqr-neg47.1%
sqrt-unprod46.9%
add-sqr-sqrt47.1%
Applied egg-rr47.1%
if -2e3 < (+.f64 y z) < 3.99999999999999992e-12Initial program 100.0%
+-commutative100.0%
associate-+l-100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 99.2%
Taylor expanded in y around 0 99.2%
Final simplification60.7%
(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 77.7%
+-commutative77.7%
associate-+l-77.7%
Applied egg-rr77.7%
Taylor expanded in a around 0 51.3%
neg-mul-151.3%
Simplified51.3%
sub-neg51.3%
+-commutative51.3%
add-sqr-sqrt0.0%
sqrt-unprod3.5%
sqr-neg3.5%
sqrt-unprod3.5%
add-sqr-sqrt3.5%
add-sqr-sqrt0.0%
sqrt-unprod51.3%
sqr-neg51.3%
sqrt-unprod51.1%
add-sqr-sqrt51.3%
Applied egg-rr51.3%
Final simplification51.3%
(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 77.7%
Taylor expanded in x around inf 32.9%
Final simplification32.9%
herbie shell --seed 2024076
(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))))