
(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 (+ (- (/ (+ (tan y) (tan z)) (+ 1.0 (+ 1.0 (- -1.0 (* (tan y) (tan z)))))) (tan a)) x))
double code(double x, double y, double z, double a) {
return (((tan(y) + tan(z)) / (1.0 + (1.0 + (-1.0 - (tan(y) * tan(z)))))) - tan(a)) + 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 = (((tan(y) + tan(z)) / (1.0d0 + (1.0d0 + ((-1.0d0) - (tan(y) * tan(z)))))) - tan(a)) + x
end function
public static double code(double x, double y, double z, double a) {
return (((Math.tan(y) + Math.tan(z)) / (1.0 + (1.0 + (-1.0 - (Math.tan(y) * Math.tan(z)))))) - Math.tan(a)) + x;
}
def code(x, y, z, a): return (((math.tan(y) + math.tan(z)) / (1.0 + (1.0 + (-1.0 - (math.tan(y) * math.tan(z)))))) - math.tan(a)) + x
function code(x, y, z, a) return Float64(Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 + Float64(1.0 + Float64(-1.0 - Float64(tan(y) * tan(z)))))) - tan(a)) + x) end
function tmp = code(x, y, z, a) tmp = (((tan(y) + tan(z)) / (1.0 + (1.0 + (-1.0 - (tan(y) * tan(z)))))) - tan(a)) + x; end
code[x_, y_, z_, a_] := N[(N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(1.0 + N[(-1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{\tan y + \tan z}{1 + \left(1 + \left(-1 - \tan y \cdot \tan z\right)\right)} - \tan a\right) + x
\end{array}
Initial program 81.2%
+-commutative81.2%
sub-neg81.2%
associate-+l+81.2%
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%
expm1-log1p-u94.7%
expm1-undefine94.7%
log1p-undefine94.7%
add-exp-log99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (tan (+ y z))))
(if (<= (tan a) -0.02)
(+ x (- t_0 (/ (sin a) (cos a))))
(if (<= (tan a) 2e-33)
(+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) a))
(+ t_0 (- x (tan a)))))))
double code(double x, double y, double z, double a) {
double t_0 = tan((y + z));
double tmp;
if (tan(a) <= -0.02) {
tmp = x + (t_0 - (sin(a) / cos(a)));
} else if (tan(a) <= 2e-33) {
tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - a);
} else {
tmp = t_0 + (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) :: t_0
real(8) :: tmp
t_0 = tan((y + z))
if (tan(a) <= (-0.02d0)) then
tmp = x + (t_0 - (sin(a) / cos(a)))
else if (tan(a) <= 2d-33) then
tmp = x + (((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) - a)
else
tmp = t_0 + (x - 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 + z));
double tmp;
if (Math.tan(a) <= -0.02) {
tmp = x + (t_0 - (Math.sin(a) / Math.cos(a)));
} else if (Math.tan(a) <= 2e-33) {
tmp = x + (((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
} else {
tmp = t_0 + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): t_0 = math.tan((y + z)) tmp = 0 if math.tan(a) <= -0.02: tmp = x + (t_0 - (math.sin(a) / math.cos(a))) elif math.tan(a) <= 2e-33: tmp = x + (((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) - a) else: tmp = t_0 + (x - math.tan(a)) return tmp
function code(x, y, z, a) t_0 = tan(Float64(y + z)) tmp = 0.0 if (tan(a) <= -0.02) tmp = Float64(x + Float64(t_0 - Float64(sin(a) / cos(a)))); elseif (tan(a) <= 2e-33) tmp = Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))) - a)); else tmp = Float64(t_0 + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) t_0 = tan((y + z)); tmp = 0.0; if (tan(a) <= -0.02) tmp = x + (t_0 - (sin(a) / cos(a))); elseif (tan(a) <= 2e-33) tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - a); else tmp = t_0 + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.02], N[(x + N[(t$95$0 - N[(N[Sin[a], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 2e-33], 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[(t$95$0 + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan \left(y + z\right)\\
\mathbf{if}\;\tan a \leq -0.02:\\
\;\;\;\;x + \left(t\_0 - \frac{\sin a}{\cos a}\right)\\
\mathbf{elif}\;\tan a \leq 2 \cdot 10^{-33}:\\
\;\;\;\;x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0200000000000000004Initial program 80.4%
Taylor expanded in a around inf 80.4%
if -0.0200000000000000004 < (tan.f64 a) < 2.0000000000000001e-33Initial program 81.1%
Taylor expanded in a around 0 81.1%
tan-sum99.9%
div-inv99.9%
Applied egg-rr99.9%
associate-*r/99.9%
*-rgt-identity99.9%
Simplified99.9%
if 2.0000000000000001e-33 < (tan.f64 a) Initial program 82.2%
+-commutative82.2%
associate-+l-82.2%
Applied egg-rr82.2%
Final simplification89.2%
(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 81.2%
+-commutative81.2%
sub-neg81.2%
associate-+l+81.2%
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 (if (or (<= a -1e-20) (not (<= a 2.1e-19))) (+ x (- (tan y) (tan a))) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -1e-20) || !(a <= 2.1e-19)) {
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 <= (-1d-20)) .or. (.not. (a <= 2.1d-19))) 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 <= -1e-20) || !(a <= 2.1e-19)) {
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 <= -1e-20) or not (a <= 2.1e-19): 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 <= -1e-20) || !(a <= 2.1e-19)) 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 <= -1e-20) || ~((a <= 2.1e-19))) 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, -1e-20], N[Not[LessEqual[a, 2.1e-19]], $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 -1 \cdot 10^{-20} \lor \neg \left(a \leq 2.1 \cdot 10^{-19}\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 < -9.99999999999999945e-21 or 2.0999999999999999e-19 < a Initial program 80.5%
Taylor expanded in y around inf 61.4%
if -9.99999999999999945e-21 < a < 2.0999999999999999e-19Initial program 82.2%
Taylor expanded in a around 0 82.2%
Final simplification70.1%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -4e-7) (+ x (- (tan y) (tan a))) (+ x (- (tan z) (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -4e-7) {
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 + z) <= (-4d-7)) 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 + z) <= -4e-7) {
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 + z) <= -4e-7: 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 (Float64(y + z) <= -4e-7) 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 + z) <= -4e-7) 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[N[(y + z), $MachinePrecision], -4e-7], 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 + z \leq -4 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -3.9999999999999998e-7Initial program 75.8%
Taylor expanded in y around inf 47.2%
if -3.9999999999999998e-7 < (+.f64 y z) Initial program 84.7%
Taylor expanded in y around 0 65.2%
(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 81.2%
(FPCore (x y z a) :precision binary64 (if (or (<= a -1.2e+15) (not (<= a 1.7))) (+ -1.0 (+ (+ 2.0 (+ z (- x (tan a)))) -1.0)) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -1.2e+15) || !(a <= 1.7)) {
tmp = -1.0 + ((2.0 + (z + (x - tan(a)))) + -1.0);
} 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 <= (-1.2d+15)) .or. (.not. (a <= 1.7d0))) then
tmp = (-1.0d0) + ((2.0d0 + (z + (x - tan(a)))) + (-1.0d0))
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 <= -1.2e+15) || !(a <= 1.7)) {
tmp = -1.0 + ((2.0 + (z + (x - Math.tan(a)))) + -1.0);
} else {
tmp = x + (Math.tan((y + z)) - a);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (a <= -1.2e+15) or not (a <= 1.7): tmp = -1.0 + ((2.0 + (z + (x - math.tan(a)))) + -1.0) else: tmp = x + (math.tan((y + z)) - a) return tmp
function code(x, y, z, a) tmp = 0.0 if ((a <= -1.2e+15) || !(a <= 1.7)) tmp = Float64(-1.0 + Float64(Float64(2.0 + Float64(z + Float64(x - tan(a)))) + -1.0)); 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 <= -1.2e+15) || ~((a <= 1.7))) tmp = -1.0 + ((2.0 + (z + (x - tan(a)))) + -1.0); else tmp = x + (tan((y + z)) - a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[Or[LessEqual[a, -1.2e+15], N[Not[LessEqual[a, 1.7]], $MachinePrecision]], N[(-1.0 + N[(N[(2.0 + N[(z + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $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 -1.2 \cdot 10^{+15} \lor \neg \left(a \leq 1.7\right):\\
\;\;\;\;-1 + \left(\left(2 + \left(z + \left(x - \tan a\right)\right)\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
if a < -1.2e15 or 1.69999999999999996 < a Initial program 81.1%
Taylor expanded in y around 0 61.8%
+-commutative61.8%
associate--l+61.8%
Simplified61.8%
expm1-log1p-u58.7%
expm1-undefine58.7%
tan-quot58.7%
tan-quot58.7%
Applied egg-rr58.7%
expm1-log1p-u58.5%
expm1-undefine58.5%
log1p-undefine58.5%
rem-exp-log59.4%
associate-+r-59.4%
Applied egg-rr59.4%
sub-neg59.4%
log1p-undefine59.3%
+-commutative59.3%
rem-exp-log61.7%
+-commutative61.7%
associate-+r+61.7%
metadata-eval61.7%
associate-+r-61.7%
metadata-eval61.7%
Simplified61.7%
Taylor expanded in z around 0 31.1%
if -1.2e15 < a < 1.69999999999999996Initial program 81.3%
Taylor expanded in a around 0 78.1%
Final simplification52.9%
(FPCore (x y z a)
:precision binary64
(if (<= a -6.8e-12)
x
(if (<= a 2.1e-103)
(+ x (- (tan y) a))
(if (<= a 2.1e-19) (+ x (- (tan z) a)) x))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -6.8e-12) {
tmp = x;
} else if (a <= 2.1e-103) {
tmp = x + (tan(y) - a);
} else if (a <= 2.1e-19) {
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 <= (-6.8d-12)) then
tmp = x
else if (a <= 2.1d-103) then
tmp = x + (tan(y) - a)
else if (a <= 2.1d-19) 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 <= -6.8e-12) {
tmp = x;
} else if (a <= 2.1e-103) {
tmp = x + (Math.tan(y) - a);
} else if (a <= 2.1e-19) {
tmp = x + (Math.tan(z) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -6.8e-12: tmp = x elif a <= 2.1e-103: tmp = x + (math.tan(y) - a) elif a <= 2.1e-19: tmp = x + (math.tan(z) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -6.8e-12) tmp = x; elseif (a <= 2.1e-103) tmp = Float64(x + Float64(tan(y) - a)); elseif (a <= 2.1e-19) 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 <= -6.8e-12) tmp = x; elseif (a <= 2.1e-103) tmp = x + (tan(y) - a); elseif (a <= 2.1e-19) tmp = x + (tan(z) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -6.8e-12], x, If[LessEqual[a, 2.1e-103], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.1e-19], N[(x + N[(N[Tan[z], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.8 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-103}:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-19}:\\
\;\;\;\;x + \left(\tan z - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6.8000000000000001e-12 or 2.0999999999999999e-19 < a Initial program 80.6%
Taylor expanded in x around inf 23.2%
if -6.8000000000000001e-12 < a < 2.10000000000000005e-103Initial program 81.6%
Taylor expanded in a around 0 81.6%
Taylor expanded in y around inf 61.9%
if 2.10000000000000005e-103 < a < 2.0999999999999999e-19Initial program 83.6%
Taylor expanded in a around 0 83.6%
Taylor expanded in y around 0 45.1%
(FPCore (x y z a) :precision binary64 (if (<= a -6.8e-12) x (if (<= a 1.6) (+ x (- (tan (+ y z)) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -6.8e-12) {
tmp = x;
} else if (a <= 1.6) {
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 <= (-6.8d-12)) then
tmp = x
else if (a <= 1.6d0) 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 <= -6.8e-12) {
tmp = x;
} else if (a <= 1.6) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -6.8e-12: tmp = x elif a <= 1.6: tmp = x + (math.tan((y + z)) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -6.8e-12) tmp = x; elseif (a <= 1.6) 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 <= -6.8e-12) tmp = x; elseif (a <= 1.6) tmp = x + (tan((y + z)) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -6.8e-12], x, If[LessEqual[a, 1.6], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.8 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.6:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6.8000000000000001e-12 or 1.6000000000000001 < a Initial program 80.2%
Taylor expanded in x around inf 22.7%
if -6.8000000000000001e-12 < a < 1.6000000000000001Initial program 82.4%
Taylor expanded in a around 0 81.6%
(FPCore (x y z a) :precision binary64 (if (<= a -6.8e-12) x (if (<= a 1.6) (+ x (- (tan y) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -6.8e-12) {
tmp = x;
} else if (a <= 1.6) {
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 <= (-6.8d-12)) then
tmp = x
else if (a <= 1.6d0) 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 <= -6.8e-12) {
tmp = x;
} else if (a <= 1.6) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -6.8e-12: tmp = x elif a <= 1.6: tmp = x + (math.tan(y) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -6.8e-12) tmp = x; elseif (a <= 1.6) 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 <= -6.8e-12) tmp = x; elseif (a <= 1.6) tmp = x + (tan(y) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -6.8e-12], x, If[LessEqual[a, 1.6], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.8 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.6:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6.8000000000000001e-12 or 1.6000000000000001 < a Initial program 80.2%
Taylor expanded in x around inf 22.7%
if -6.8000000000000001e-12 < a < 1.6000000000000001Initial program 82.4%
Taylor expanded in a around 0 81.6%
Taylor expanded in y around inf 64.1%
(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 81.2%
Taylor expanded in x around inf 31.5%
herbie shell --seed 2024179
(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))))