
(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 15 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)) (fma (tan y) (- (tan z)) 1.0)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (((tan(y) + tan(z)) / fma(tan(y), -tan(z), 1.0)) - tan(a));
}
function code(x, y, z, a) return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / fma(tan(y), Float64(-tan(z)), 1.0)) - tan(a))) end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(N[Tan[y], $MachinePrecision] * (-N[Tan[z], $MachinePrecision]) + 1.0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\frac{\tan y + \tan z}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)} - \tan a\right)
\end{array}
Initial program 75.5%
tan-sum99.6%
div-inv99.7%
Applied egg-rr99.7%
tan-quot99.6%
clear-num99.6%
un-div-inv99.7%
clear-num99.6%
tan-quot99.7%
Applied egg-rr99.7%
fma-neg99.6%
div-inv99.6%
inv-pow99.6%
pow-flip99.6%
metadata-eval99.6%
pow199.6%
Applied egg-rr99.6%
fma-undefine99.7%
unsub-neg99.7%
associate-/l*99.6%
*-rgt-identity99.6%
sub-neg99.6%
+-commutative99.6%
distribute-rgt-neg-in99.6%
fma-define99.7%
Simplified99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ (tan y) (tan z))))
(if (<= (tan a) -0.0001)
(+ x (+ (tan (+ y z)) (* (sin a) (/ -1.0 (cos a)))))
(if (<= (tan a) 1e-6)
(+ x (- (/ t_0 (- 1.0 (* (tan y) (tan z)))) a))
(+ x (- t_0 (tan a)))))))
double code(double x, double y, double z, double a) {
double t_0 = tan(y) + tan(z);
double tmp;
if (tan(a) <= -0.0001) {
tmp = x + (tan((y + z)) + (sin(a) * (-1.0 / cos(a))));
} else if (tan(a) <= 1e-6) {
tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - a);
} else {
tmp = x + (t_0 - 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) :: tmp
t_0 = tan(y) + tan(z)
if (tan(a) <= (-0.0001d0)) then
tmp = x + (tan((y + z)) + (sin(a) * ((-1.0d0) / cos(a))))
else if (tan(a) <= 1d-6) then
tmp = x + ((t_0 / (1.0d0 - (tan(y) * tan(z)))) - a)
else
tmp = x + (t_0 - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double t_0 = Math.tan(y) + Math.tan(z);
double tmp;
if (Math.tan(a) <= -0.0001) {
tmp = x + (Math.tan((y + z)) + (Math.sin(a) * (-1.0 / Math.cos(a))));
} else if (Math.tan(a) <= 1e-6) {
tmp = x + ((t_0 / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
} else {
tmp = x + (t_0 - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): t_0 = math.tan(y) + math.tan(z) tmp = 0 if math.tan(a) <= -0.0001: tmp = x + (math.tan((y + z)) + (math.sin(a) * (-1.0 / math.cos(a)))) elif math.tan(a) <= 1e-6: tmp = x + ((t_0 / (1.0 - (math.tan(y) * math.tan(z)))) - a) else: tmp = x + (t_0 - math.tan(a)) return tmp
function code(x, y, z, a) t_0 = Float64(tan(y) + tan(z)) tmp = 0.0 if (tan(a) <= -0.0001) tmp = Float64(x + Float64(tan(Float64(y + z)) + Float64(sin(a) * Float64(-1.0 / cos(a))))); elseif (tan(a) <= 1e-6) tmp = Float64(x + Float64(Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))) - a)); else tmp = Float64(x + Float64(t_0 - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) t_0 = tan(y) + tan(z); tmp = 0.0; if (tan(a) <= -0.0001) tmp = x + (tan((y + z)) + (sin(a) * (-1.0 / cos(a)))); elseif (tan(a) <= 1e-6) tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - a); else tmp = x + (t_0 - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.0001], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[a], $MachinePrecision] * N[(-1.0 / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 1e-6], N[(x + N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$0 - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;\tan a \leq -0.0001:\\
\;\;\;\;x + \left(\tan \left(y + z\right) + \sin a \cdot \frac{-1}{\cos a}\right)\\
\mathbf{elif}\;\tan a \leq 10^{-6}:\\
\;\;\;\;x + \left(\frac{t\_0}{1 - \tan y \cdot \tan z} - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t\_0 - \tan a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -1.00000000000000005e-4Initial program 69.5%
tan-quot69.5%
div-inv69.5%
Applied egg-rr69.5%
if -1.00000000000000005e-4 < (tan.f64 a) < 9.99999999999999955e-7Initial program 76.8%
Taylor expanded in a around 0 76.8%
tan-sum99.9%
div-inv99.9%
Applied egg-rr99.9%
associate-*r/99.9%
*-rgt-identity99.9%
Simplified99.9%
if 9.99999999999999955e-7 < (tan.f64 a) Initial program 79.4%
tan-sum99.3%
div-inv99.3%
Applied egg-rr99.3%
tan-quot99.3%
clear-num99.3%
un-div-inv99.3%
clear-num99.3%
tan-quot99.4%
Applied egg-rr99.4%
fma-neg99.3%
div-inv99.2%
inv-pow99.2%
pow-flip99.3%
metadata-eval99.3%
pow199.3%
Applied egg-rr99.3%
fma-undefine99.3%
unsub-neg99.3%
associate-/l*99.3%
*-rgt-identity99.3%
sub-neg99.3%
+-commutative99.3%
distribute-rgt-neg-in99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in y around 0 80.0%
Final simplification86.2%
(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 75.5%
tan-sum99.6%
div-inv99.7%
Applied egg-rr99.7%
(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 75.5%
+-commutative75.5%
sub-neg75.5%
associate-+l+75.4%
tan-sum99.6%
div-inv99.6%
fma-define99.6%
neg-mul-199.6%
fma-define99.6%
Applied egg-rr99.6%
fma-undefine99.6%
fma-undefine99.6%
neg-mul-199.6%
associate-+r+99.7%
unsub-neg99.7%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z a) :precision binary64 (if (or (<= (tan a) -5e-45) (not (<= (tan a) 2e-23))) (+ x (- (tan y) (tan a))) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((tan(a) <= -5e-45) || !(tan(a) <= 2e-23)) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = x + (tan((y + z)) - 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 ((tan(a) <= (-5d-45)) .or. (.not. (tan(a) <= 2d-23))) then
tmp = x + (tan(y) - tan(a))
else
tmp = x + (tan((y + z)) - a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((Math.tan(a) <= -5e-45) || !(Math.tan(a) <= 2e-23)) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = x + (Math.tan((y + z)) - a);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (math.tan(a) <= -5e-45) or not (math.tan(a) <= 2e-23): tmp = x + (math.tan(y) - math.tan(a)) else: tmp = x + (math.tan((y + z)) - a) return tmp
function code(x, y, z, a) tmp = 0.0 if ((tan(a) <= -5e-45) || !(tan(a) <= 2e-23)) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((tan(a) <= -5e-45) || ~((tan(a) <= 2e-23))) tmp = x + (tan(y) - tan(a)); else tmp = x + (tan((y + z)) - a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[Or[LessEqual[N[Tan[a], $MachinePrecision], -5e-45], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 2e-23]], $MachinePrecision]], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -5 \cdot 10^{-45} \lor \neg \left(\tan a \leq 2 \cdot 10^{-23}\right):\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -4.99999999999999976e-45 or 1.99999999999999992e-23 < (tan.f64 a) Initial program 73.0%
Taylor expanded in y around inf 52.6%
if -4.99999999999999976e-45 < (tan.f64 a) < 1.99999999999999992e-23Initial program 78.9%
Taylor expanded in a around 0 78.9%
Final simplification63.7%
(FPCore (x y z a) :precision binary64 (+ x (+ (tan (+ y z)) (/ -1.0 (/ (cos a) (sin a))))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) + (-1.0 / (cos(a) / sin(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)) + ((-1.0d0) / (cos(a) / sin(a))))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) + (-1.0 / (Math.cos(a) / Math.sin(a))));
}
def code(x, y, z, a): return x + (math.tan((y + z)) + (-1.0 / (math.cos(a) / math.sin(a))))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) + Float64(-1.0 / Float64(cos(a) / sin(a))))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) + (-1.0 / (cos(a) / sin(a)))); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] + N[(-1.0 / N[(N[Cos[a], $MachinePrecision] / N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) + \frac{-1}{\frac{\cos a}{\sin a}}\right)
\end{array}
Initial program 75.5%
tan-quot75.5%
clear-num75.5%
Applied egg-rr75.5%
Final simplification75.5%
(FPCore (x y z a)
:precision binary64
(if (<= a -1.55)
x
(if (<= a 7.6e-7)
(+ x (- (tan (+ y z)) a))
(pow (pow x 3.0) 0.3333333333333333))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.55) {
tmp = x;
} else if (a <= 7.6e-7) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = pow(pow(x, 3.0), 0.3333333333333333);
}
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 <= (-1.55d0)) then
tmp = x
else if (a <= 7.6d-7) then
tmp = x + (tan((y + z)) - a)
else
tmp = (x ** 3.0d0) ** 0.3333333333333333d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.55) {
tmp = x;
} else if (a <= 7.6e-7) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = Math.pow(Math.pow(x, 3.0), 0.3333333333333333);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -1.55: tmp = x elif a <= 7.6e-7: tmp = x + (math.tan((y + z)) - a) else: tmp = math.pow(math.pow(x, 3.0), 0.3333333333333333) return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -1.55) tmp = x; elseif (a <= 7.6e-7) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = (x ^ 3.0) ^ 0.3333333333333333; end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -1.55) tmp = x; elseif (a <= 7.6e-7) tmp = x + (tan((y + z)) - a); else tmp = (x ^ 3.0) ^ 0.3333333333333333; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -1.55], x, If[LessEqual[a, 7.6e-7], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[Power[N[Power[x, 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;{\left({x}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if a < -1.55000000000000004Initial program 71.5%
Taylor expanded in x around inf 21.5%
if -1.55000000000000004 < a < 7.60000000000000029e-7Initial program 77.5%
Taylor expanded in a around 0 77.3%
if 7.60000000000000029e-7 < a Initial program 75.9%
Taylor expanded in y around 0 62.0%
tan-quot62.0%
add-cbrt-cube61.7%
pow1/357.0%
pow357.0%
tan-quot57.0%
associate--l+57.0%
Applied egg-rr57.0%
Taylor expanded in x around inf 21.8%
(FPCore (x y z a) :precision binary64 (if (<= y -3.25e-9) (+ x (- (tan y) (tan a))) (- (+ x (tan z)) (tan a))))
double code(double x, double y, double z, double a) {
double tmp;
if (y <= -3.25e-9) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = (x + tan(z)) - 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 <= (-3.25d-9)) then
tmp = x + (tan(y) - tan(a))
else
tmp = (x + tan(z)) - tan(a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (y <= -3.25e-9) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = (x + Math.tan(z)) - Math.tan(a);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if y <= -3.25e-9: tmp = x + (math.tan(y) - math.tan(a)) else: tmp = (x + math.tan(z)) - math.tan(a) return tmp
function code(x, y, z, a) tmp = 0.0 if (y <= -3.25e-9) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(Float64(x + tan(z)) - tan(a)); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (y <= -3.25e-9) tmp = x + (tan(y) - tan(a)); else tmp = (x + tan(z)) - tan(a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[y, -3.25e-9], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Tan[z], $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{-9}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \tan z\right) - \tan a\\
\end{array}
\end{array}
if y < -3.2500000000000002e-9Initial program 49.3%
Taylor expanded in y around inf 47.6%
if -3.2500000000000002e-9 < y Initial program 83.7%
Taylor expanded in y around 0 70.3%
tan-quot70.3%
sub-neg70.3%
tan-quot70.3%
+-commutative70.3%
associate-+l+70.3%
Applied egg-rr70.3%
associate-+r+70.3%
unsub-neg70.3%
+-commutative70.3%
Simplified70.3%
(FPCore (x y z a) :precision binary64 (if (<= y -5.9e-9) (+ x (- (tan y) (tan a))) (+ x (- (tan z) (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if (y <= -5.9e-9) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = x + (tan(z) - 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 <= (-5.9d-9)) then
tmp = x + (tan(y) - tan(a))
else
tmp = x + (tan(z) - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (y <= -5.9e-9) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = x + (Math.tan(z) - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if y <= -5.9e-9: tmp = x + (math.tan(y) - math.tan(a)) else: tmp = x + (math.tan(z) - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (y <= -5.9e-9) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(x + Float64(tan(z) - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (y <= -5.9e-9) tmp = x + (tan(y) - tan(a)); else tmp = x + (tan(z) - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[y, -5.9e-9], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{-9}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if y < -5.8999999999999999e-9Initial program 49.3%
Taylor expanded in y around inf 47.6%
if -5.8999999999999999e-9 < y Initial program 83.7%
Taylor expanded in y around 0 70.3%
(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 75.5%
(FPCore (x y z a)
:precision binary64
(if (<= a -4.6)
x
(if (<= a -2.2e-201)
(+ x (- (tan y) a))
(if (<= a 7.6e-7) (+ x (- (tan z) a)) x))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -4.6) {
tmp = x;
} else if (a <= -2.2e-201) {
tmp = x + (tan(y) - a);
} else if (a <= 7.6e-7) {
tmp = x + (tan(z) - a);
} else {
tmp = x;
}
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 <= (-4.6d0)) then
tmp = x
else if (a <= (-2.2d-201)) then
tmp = x + (tan(y) - a)
else if (a <= 7.6d-7) then
tmp = x + (tan(z) - a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -4.6) {
tmp = x;
} else if (a <= -2.2e-201) {
tmp = x + (Math.tan(y) - a);
} else if (a <= 7.6e-7) {
tmp = x + (Math.tan(z) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -4.6: tmp = x elif a <= -2.2e-201: tmp = x + (math.tan(y) - a) elif a <= 7.6e-7: tmp = x + (math.tan(z) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -4.6) tmp = x; elseif (a <= -2.2e-201) tmp = Float64(x + Float64(tan(y) - a)); elseif (a <= 7.6e-7) tmp = Float64(x + Float64(tan(z) - a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -4.6) tmp = x; elseif (a <= -2.2e-201) tmp = x + (tan(y) - a); elseif (a <= 7.6e-7) tmp = x + (tan(z) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -4.6], x, If[LessEqual[a, -2.2e-201], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 7.6e-7], N[(x + N[(N[Tan[z], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -2.2 \cdot 10^{-201}:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\tan z - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.5999999999999996 or 7.60000000000000029e-7 < a Initial program 73.8%
Taylor expanded in x around inf 21.6%
if -4.5999999999999996 < a < -2.2e-201Initial program 77.2%
Taylor expanded in a around 0 76.8%
Taylor expanded in y around inf 56.6%
if -2.2e-201 < a < 7.60000000000000029e-7Initial program 77.6%
Taylor expanded in a around 0 77.6%
Taylor expanded in y around 0 59.0%
(FPCore (x y z a) :precision binary64 (if (<= a -4.6) x (if (<= a 7.6e-7) (+ x (- (tan (+ y z)) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -4.6) {
tmp = x;
} else if (a <= 7.6e-7) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = x;
}
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 <= (-4.6d0)) then
tmp = x
else if (a <= 7.6d-7) then
tmp = x + (tan((y + z)) - a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -4.6) {
tmp = x;
} else if (a <= 7.6e-7) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -4.6: tmp = x elif a <= 7.6e-7: tmp = x + (math.tan((y + z)) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -4.6) tmp = x; elseif (a <= 7.6e-7) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -4.6) tmp = x; elseif (a <= 7.6e-7) tmp = x + (tan((y + z)) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -4.6], x, If[LessEqual[a, 7.6e-7], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.5999999999999996 or 7.60000000000000029e-7 < a Initial program 73.8%
Taylor expanded in x around inf 21.6%
if -4.5999999999999996 < a < 7.60000000000000029e-7Initial program 77.5%
Taylor expanded in a around 0 77.3%
(FPCore (x y z a) :precision binary64 (if (<= a -1.65) x (if (<= a 7.6e-7) (+ x (- (tan y) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.65) {
tmp = x;
} else if (a <= 7.6e-7) {
tmp = x + (tan(y) - a);
} else {
tmp = x;
}
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 <= (-1.65d0)) then
tmp = x
else if (a <= 7.6d-7) then
tmp = x + (tan(y) - a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.65) {
tmp = x;
} else if (a <= 7.6e-7) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -1.65: tmp = x elif a <= 7.6e-7: tmp = x + (math.tan(y) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -1.65) tmp = x; elseif (a <= 7.6e-7) tmp = Float64(x + Float64(tan(y) - a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -1.65) tmp = x; elseif (a <= 7.6e-7) tmp = x + (tan(y) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -1.65], x, If[LessEqual[a, 7.6e-7], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.65:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.6499999999999999 or 7.60000000000000029e-7 < a Initial program 73.8%
Taylor expanded in x around inf 21.6%
if -1.6499999999999999 < a < 7.60000000000000029e-7Initial program 77.5%
Taylor expanded in a around 0 77.3%
Taylor expanded in y around inf 57.5%
(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 75.5%
Taylor expanded in x around inf 30.1%
(FPCore (x y z a) :precision binary64 a)
double code(double x, double y, double z, double a) {
return 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 = a
end function
public static double code(double x, double y, double z, double a) {
return a;
}
def code(x, y, z, a): return a
function code(x, y, z, a) return a end
function tmp = code(x, y, z, a) tmp = a; end
code[x_, y_, z_, a_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 75.5%
Taylor expanded in a around 0 37.4%
Taylor expanded in a around inf 3.5%
neg-mul-13.5%
Simplified3.5%
add-sqr-sqrt2.6%
sqrt-unprod4.9%
sqr-neg4.9%
sqrt-unprod2.6%
add-sqr-sqrt3.6%
*-un-lft-identity3.6%
Applied egg-rr3.6%
*-lft-identity3.6%
Simplified3.6%
herbie shell --seed 2024137
(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))))