
(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 82.9%
tan-sum99.8%
div-inv99.8%
fmm-def99.8%
Applied egg-rr99.8%
fmm-undef99.8%
Simplified99.8%
Final simplification99.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 82.9%
+-commutative82.9%
sub-neg82.9%
associate-+l+82.8%
tan-sum99.7%
div-inv99.7%
fma-define99.7%
neg-mul-199.7%
fma-define99.7%
Applied egg-rr99.7%
fma-undefine99.7%
fma-undefine99.7%
neg-mul-199.7%
associate-+r+99.8%
sub-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (/ 1.0 (/ (cos (+ y z)) (sin (+ y z))))))
(if (<= a -9.8e-5)
(+ t_0 (- x (tan a)))
(if (<= a 2.1e-11)
(+ x (- (/ (+ (tan y) (tan z)) (- 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 = 1.0 / (cos((y + z)) / sin((y + z)));
double tmp;
if (a <= -9.8e-5) {
tmp = t_0 + (x - tan(a));
} else if (a <= 2.1e-11) {
tmp = x + (((tan(y) + tan(z)) / (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 = 1.0d0 / (cos((y + z)) / sin((y + z)))
if (a <= (-9.8d-5)) then
tmp = t_0 + (x - tan(a))
else if (a <= 2.1d-11) then
tmp = x + (((tan(y) + tan(z)) / (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 = 1.0 / (Math.cos((y + z)) / Math.sin((y + z)));
double tmp;
if (a <= -9.8e-5) {
tmp = t_0 + (x - Math.tan(a));
} else if (a <= 2.1e-11) {
tmp = x + (((Math.tan(y) + Math.tan(z)) / (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 = 1.0 / (math.cos((y + z)) / math.sin((y + z))) tmp = 0 if a <= -9.8e-5: tmp = t_0 + (x - math.tan(a)) elif a <= 2.1e-11: tmp = x + (((math.tan(y) + math.tan(z)) / (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(1.0 / Float64(cos(Float64(y + z)) / sin(Float64(y + z)))) tmp = 0.0 if (a <= -9.8e-5) tmp = Float64(t_0 + Float64(x - tan(a))); elseif (a <= 2.1e-11) tmp = Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / 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 = 1.0 / (cos((y + z)) / sin((y + z))); tmp = 0.0; if (a <= -9.8e-5) tmp = t_0 + (x - tan(a)); elseif (a <= 2.1e-11) tmp = x + (((tan(y) + tan(z)) / (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[(1.0 / N[(N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision] / N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -9.8e-5], N[(t$95$0 + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.1e-11], 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] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$0 - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}}\\
\mathbf{if}\;a \leq -9.8 \cdot 10^{-5}:\\
\;\;\;\;t\_0 + \left(x - \tan a\right)\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-11}:\\
\;\;\;\;x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t\_0 - \tan a\right)\\
\end{array}
\end{array}
if a < -9.8e-5Initial program 82.3%
+-commutative82.3%
sub-neg82.3%
associate-+l+82.3%
tan-quot82.3%
div-inv82.3%
fma-define82.3%
neg-mul-182.3%
fma-define82.3%
Applied egg-rr82.3%
fma-undefine82.3%
neg-mul-182.3%
neg-sub082.3%
associate-+l-82.3%
neg-sub082.3%
fmm-undef82.3%
associate-*r/82.3%
*-rgt-identity82.3%
Simplified82.3%
add-cbrt-cube43.1%
pow343.1%
Applied egg-rr43.1%
clear-num43.1%
inv-pow43.1%
rem-cbrt-cube82.3%
Applied egg-rr82.3%
unpow-182.3%
Simplified82.3%
if -9.8e-5 < a < 2.0999999999999999e-11Initial program 82.2%
Taylor expanded in a around 0 82.2%
tan-sum99.9%
div-inv99.9%
fmm-def99.9%
Applied egg-rr99.9%
fmm-undef99.9%
associate-*r/99.9%
*-rgt-identity99.9%
Simplified99.9%
if 2.0999999999999999e-11 < a Initial program 84.8%
tan-quot84.8%
clear-num84.8%
Applied egg-rr84.8%
Final simplification92.0%
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (log (exp (tan a))))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - log(exp(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)) - log(exp(tan(a))))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.log(Math.exp(Math.tan(a))));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.log(math.exp(math.tan(a))))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - log(exp(tan(a))))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - log(exp(tan(a)))); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Log[N[Exp[N[Tan[a], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \log \left(e^{\tan a}\right)\right)
\end{array}
Initial program 82.9%
add-log-exp82.9%
Applied egg-rr82.9%
(FPCore (x y z a) :precision binary64 (if (or (<= a -0.005) (not (<= a 0.00076))) (+ x (- (tan y) (tan a))) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -0.005) || !(a <= 0.00076)) {
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 ((a <= (-0.005d0)) .or. (.not. (a <= 0.00076d0))) 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 ((a <= -0.005) || !(a <= 0.00076)) {
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 (a <= -0.005) or not (a <= 0.00076): 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 ((a <= -0.005) || !(a <= 0.00076)) 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 ((a <= -0.005) || ~((a <= 0.00076))) 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[a, -0.005], N[Not[LessEqual[a, 0.00076]], $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}\;a \leq -0.005 \lor \neg \left(a \leq 0.00076\right):\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
if a < -0.0050000000000000001 or 7.6000000000000004e-4 < a Initial program 83.5%
Taylor expanded in y around inf 63.5%
if -0.0050000000000000001 < a < 7.6000000000000004e-4Initial program 82.4%
Taylor expanded in a around 0 82.4%
Final simplification73.3%
(FPCore (x y z a) :precision binary64 (if (<= y -5.5e-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.5e-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.5d-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.5e-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.5e-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.5e-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.5e-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.5e-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.5 \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.4999999999999996e-9Initial program 65.4%
Taylor expanded in y around inf 65.4%
if -5.4999999999999996e-9 < y Initial program 87.7%
Taylor expanded in y around 0 74.7%
(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 82.9%
(FPCore (x y z a) :precision binary64 (if (<= a -8.0) x (if (<= a 1.65) (+ x (- (tan (+ y z)) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -8.0) {
tmp = x;
} else if (a <= 1.65) {
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 <= (-8.0d0)) then
tmp = x
else if (a <= 1.65d0) 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 <= -8.0) {
tmp = x;
} else if (a <= 1.65) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -8.0: tmp = x elif a <= 1.65: tmp = x + (math.tan((y + z)) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -8.0) tmp = x; elseif (a <= 1.65) 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 <= -8.0) tmp = x; elseif (a <= 1.65) tmp = x + (tan((y + z)) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -8.0], x, If[LessEqual[a, 1.65], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.65:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -8 or 1.6499999999999999 < a Initial program 83.2%
Taylor expanded in x around inf 23.0%
if -8 < a < 1.6499999999999999Initial program 82.6%
Taylor expanded in a around 0 82.2%
(FPCore (x y z a) :precision binary64 (if (<= a -7.8) x (if (<= a 1.56) (+ x (- (tan y) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -7.8) {
tmp = x;
} else if (a <= 1.56) {
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 <= (-7.8d0)) then
tmp = x
else if (a <= 1.56d0) 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 <= -7.8) {
tmp = x;
} else if (a <= 1.56) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -7.8: tmp = x elif a <= 1.56: tmp = x + (math.tan(y) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -7.8) tmp = x; elseif (a <= 1.56) 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 <= -7.8) tmp = x; elseif (a <= 1.56) tmp = x + (tan(y) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -7.8], x, If[LessEqual[a, 1.56], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.8:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.56:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -7.79999999999999982 or 1.5600000000000001 < a Initial program 83.2%
Taylor expanded in x around inf 23.0%
if -7.79999999999999982 < a < 1.5600000000000001Initial program 82.6%
Taylor expanded in a around 0 82.2%
Taylor expanded in y around inf 61.4%
(FPCore (x y z a) :precision binary64 (if (<= z 9.5e-13) (+ x (- (tan y) a)) (+ x (- (tan z) a))))
double code(double x, double y, double z, double a) {
double tmp;
if (z <= 9.5e-13) {
tmp = x + (tan(y) - a);
} else {
tmp = x + (tan(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 (z <= 9.5d-13) then
tmp = x + (tan(y) - a)
else
tmp = x + (tan(z) - a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (z <= 9.5e-13) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x + (Math.tan(z) - a);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if z <= 9.5e-13: tmp = x + (math.tan(y) - a) else: tmp = x + (math.tan(z) - a) return tmp
function code(x, y, z, a) tmp = 0.0 if (z <= 9.5e-13) tmp = Float64(x + Float64(tan(y) - a)); else tmp = Float64(x + Float64(tan(z) - a)); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (z <= 9.5e-13) tmp = x + (tan(y) - a); else tmp = x + (tan(z) - a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[z, 9.5e-13], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 9.5 \cdot 10^{-13}:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - a\right)\\
\end{array}
\end{array}
if z < 9.49999999999999991e-13Initial program 87.1%
Taylor expanded in a around 0 47.8%
Taylor expanded in y around inf 40.9%
if 9.49999999999999991e-13 < z Initial program 71.6%
Taylor expanded in a around 0 37.6%
Taylor expanded in y around 0 37.8%
(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 82.9%
Taylor expanded in x around inf 33.5%
herbie shell --seed 2024185
(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))))