
(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 (* (tan y) (tan z)))) (tan a)) x))
double code(double x, double y, double z, double a) {
return (((tan(y) + tan(z)) / (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 - (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 - (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 - (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(tan(y) * tan(z)))) - tan(a)) + x) end
function tmp = code(x, y, z, a) tmp = (((tan(y) + tan(z)) / (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[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) + x
\end{array}
Initial program 79.0%
+-commutative79.0%
sub-neg79.0%
associate-+l+79.0%
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.7%
unsub-neg99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
(FPCore (x y z a)
:precision binary64
(if (<= a -0.00027)
(+ x (- (/ 1.0 (/ (cos (+ y z)) (sin (+ y z)))) (tan a)))
(if (<= a 9e-6)
(+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) a))
(+ x (+ (tan (+ y z)) (/ 1.0 (/ -1.0 (tan a))))))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -0.00027) {
tmp = x + ((1.0 / (cos((y + z)) / sin((y + z)))) - tan(a));
} else if (a <= 9e-6) {
tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - a);
} else {
tmp = x + (tan((y + z)) + (1.0 / (-1.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) :: tmp
if (a <= (-0.00027d0)) then
tmp = x + ((1.0d0 / (cos((y + z)) / sin((y + z)))) - tan(a))
else if (a <= 9d-6) then
tmp = x + (((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) - a)
else
tmp = x + (tan((y + z)) + (1.0d0 / ((-1.0d0) / tan(a))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -0.00027) {
tmp = x + ((1.0 / (Math.cos((y + z)) / Math.sin((y + z)))) - Math.tan(a));
} else if (a <= 9e-6) {
tmp = x + (((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
} else {
tmp = x + (Math.tan((y + z)) + (1.0 / (-1.0 / Math.tan(a))));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -0.00027: tmp = x + ((1.0 / (math.cos((y + z)) / math.sin((y + z)))) - math.tan(a)) elif a <= 9e-6: tmp = x + (((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) - a) else: tmp = x + (math.tan((y + z)) + (1.0 / (-1.0 / math.tan(a)))) return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -0.00027) tmp = Float64(x + Float64(Float64(1.0 / Float64(cos(Float64(y + z)) / sin(Float64(y + z)))) - tan(a))); elseif (a <= 9e-6) tmp = Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))) - a)); else tmp = Float64(x + Float64(tan(Float64(y + z)) + Float64(1.0 / Float64(-1.0 / tan(a))))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -0.00027) tmp = x + ((1.0 / (cos((y + z)) / sin((y + z)))) - tan(a)); elseif (a <= 9e-6) tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - a); else tmp = x + (tan((y + z)) + (1.0 / (-1.0 / tan(a)))); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -0.00027], N[(x + N[(N[(1.0 / N[(N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision] / N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9e-6], 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[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(-1.0 / N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.00027:\\
\;\;\;\;x + \left(\frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}} - \tan a\right)\\
\mathbf{elif}\;a \leq 9 \cdot 10^{-6}:\\
\;\;\;\;x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) + \frac{1}{\frac{-1}{\tan a}}\right)\\
\end{array}
\end{array}
if a < -2.70000000000000003e-4Initial program 76.8%
tan-quot76.8%
clear-num76.8%
Applied egg-rr76.8%
if -2.70000000000000003e-4 < a < 9.00000000000000023e-6Initial program 81.4%
Taylor expanded in a around 0 81.4%
tan-sum99.8%
div-inv99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
if 9.00000000000000023e-6 < a Initial program 77.4%
tan-quot77.4%
clear-num77.4%
Applied egg-rr77.4%
*-un-lft-identity77.4%
clear-num77.4%
tan-quot77.5%
Applied egg-rr77.5%
*-lft-identity77.5%
Simplified77.5%
Final simplification87.2%
(FPCore (x y z a) :precision binary64 (if (or (<= a -82.0) (not (<= a 0.45))) (+ x (- (tan y) (tan a))) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -82.0) || !(a <= 0.45)) {
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 <= (-82.0d0)) .or. (.not. (a <= 0.45d0))) 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 <= -82.0) || !(a <= 0.45)) {
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 <= -82.0) or not (a <= 0.45): 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 <= -82.0) || !(a <= 0.45)) 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 <= -82.0) || ~((a <= 0.45))) 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, -82.0], N[Not[LessEqual[a, 0.45]], $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 -82 \lor \neg \left(a \leq 0.45\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 < -82 or 0.450000000000000011 < a Initial program 76.5%
Taylor expanded in y around inf 57.6%
if -82 < a < 0.450000000000000011Initial program 82.0%
Taylor expanded in a around 0 80.4%
Final simplification68.1%
(FPCore (x y z a) :precision binary64 (if (<= a -1.85e-25) x (if (<= a 1.6) (+ x (- (tan (+ y z)) a)) (pow (sqrt x) 2.0))))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.85e-25) {
tmp = x;
} else if (a <= 1.6) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = pow(sqrt(x), 2.0);
}
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.85d-25)) then
tmp = x
else if (a <= 1.6d0) then
tmp = x + (tan((y + z)) - a)
else
tmp = sqrt(x) ** 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.85e-25) {
tmp = x;
} else if (a <= 1.6) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = Math.pow(Math.sqrt(x), 2.0);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -1.85e-25: tmp = x elif a <= 1.6: tmp = x + (math.tan((y + z)) - a) else: tmp = math.pow(math.sqrt(x), 2.0) return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -1.85e-25) tmp = x; elseif (a <= 1.6) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = sqrt(x) ^ 2.0; end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (a <= -1.85e-25) tmp = x; elseif (a <= 1.6) tmp = x + (tan((y + z)) - a); else tmp = sqrt(x) ^ 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -1.85e-25], x, If[LessEqual[a, 1.6], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[Power[N[Sqrt[x], $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.85 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.6:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{x}\right)}^{2}\\
\end{array}
\end{array}
if a < -1.85000000000000004e-25Initial program 76.1%
Taylor expanded in x around inf 22.1%
if -1.85000000000000004e-25 < a < 1.6000000000000001Initial program 82.4%
Taylor expanded in a around 0 81.4%
if 1.6000000000000001 < a Initial program 76.4%
Taylor expanded in y around 0 58.9%
tan-quot58.9%
add-sqr-sqrt55.5%
pow255.5%
tan-quot55.5%
associate--l+55.5%
Applied egg-rr55.5%
Taylor expanded in x around inf 22.9%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -5e-132) (+ 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) <= -5e-132) {
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) <= (-5d-132)) 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) <= -5e-132) {
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) <= -5e-132: 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) <= -5e-132) 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) <= -5e-132) 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], -5e-132], 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 -5 \cdot 10^{-132}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -4.9999999999999999e-132Initial program 74.6%
Taylor expanded in y around inf 55.2%
if -4.9999999999999999e-132 < (+.f64 y z) Initial program 83.1%
Taylor expanded in y around 0 63.3%
(FPCore (x y z a) :precision binary64 (+ x (+ (tan (+ y z)) (/ 1.0 (/ -1.0 (tan a))))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) + (1.0 / (-1.0 / 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)) + (1.0d0 / ((-1.0d0) / tan(a))))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) + (1.0 / (-1.0 / Math.tan(a))));
}
def code(x, y, z, a): return x + (math.tan((y + z)) + (1.0 / (-1.0 / math.tan(a))))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) + Float64(1.0 / Float64(-1.0 / tan(a))))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) + (1.0 / (-1.0 / tan(a)))); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(-1.0 / N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) + \frac{1}{\frac{-1}{\tan a}}\right)
\end{array}
Initial program 79.0%
tan-quot79.0%
clear-num79.0%
Applied egg-rr79.0%
*-un-lft-identity79.0%
clear-num79.0%
tan-quot79.0%
Applied egg-rr79.0%
*-lft-identity79.0%
Simplified79.0%
Final simplification79.0%
(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 79.0%
(FPCore (x y z a) :precision binary64 (if (<= a -1.85e-25) 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 <= -1.85e-25) {
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 <= (-1.85d-25)) 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 <= -1.85e-25) {
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 <= -1.85e-25: 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 <= -1.85e-25) 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 <= -1.85e-25) 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, -1.85e-25], 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 -1.85 \cdot 10^{-25}:\\
\;\;\;\;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 < -1.85000000000000004e-25 or 1.6000000000000001 < a Initial program 76.2%
Taylor expanded in x around inf 22.5%
if -1.85000000000000004e-25 < a < 1.6000000000000001Initial program 82.4%
Taylor expanded in a around 0 81.4%
(FPCore (x y z a) :precision binary64 (if (<= a -1.85e-25) x (if (<= a 1.45) (+ x (- (tan y) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.85e-25) {
tmp = x;
} else if (a <= 1.45) {
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.85d-25)) then
tmp = x
else if (a <= 1.45d0) 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.85e-25) {
tmp = x;
} else if (a <= 1.45) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -1.85e-25: tmp = x elif a <= 1.45: tmp = x + (math.tan(y) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -1.85e-25) tmp = x; elseif (a <= 1.45) 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.85e-25) tmp = x; elseif (a <= 1.45) tmp = x + (tan(y) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -1.85e-25], x, If[LessEqual[a, 1.45], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.85 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.45:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.85000000000000004e-25 or 1.44999999999999996 < a Initial program 76.2%
Taylor expanded in x around inf 22.5%
if -1.85000000000000004e-25 < a < 1.44999999999999996Initial program 82.4%
Taylor expanded in a around 0 81.4%
Taylor expanded in y around inf 63.7%
(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 79.0%
Taylor expanded in x around inf 31.0%
(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 79.0%
Taylor expanded in a around 0 39.0%
Taylor expanded in a around inf 3.6%
neg-mul-13.6%
Simplified3.6%
add-sqr-sqrt2.6%
sqrt-unprod5.0%
sqr-neg5.0%
sqrt-unprod2.6%
add-sqr-sqrt3.6%
*-un-lft-identity3.6%
Applied egg-rr3.6%
*-lft-identity3.6%
Simplified3.6%
herbie shell --seed 2024143
(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))))