
(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 13 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 (- (/ 1.0 (* (- 1.0 (* (tan y) (tan z))) (/ 1.0 (+ (tan y) (tan z))))) (tan a))))
double code(double x, double y, double z, double a) {
return x + ((1.0 / ((1.0 - (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 + ((1.0d0 / ((1.0d0 - (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 + ((1.0 / ((1.0 - (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 + ((1.0 / ((1.0 - (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(1.0 / Float64(Float64(1.0 - 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 + ((1.0 / ((1.0 - (tan(y) * tan(z))) * (1.0 / (tan(y) + tan(z))))) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[(1.0 / N[(N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 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(\frac{1}{\left(1 - \tan y \cdot \tan z\right) \cdot \frac{1}{\tan y + \tan z}} - \tan a\right)
\end{array}
Initial program 78.6%
tan-sum99.7%
clear-num99.7%
Applied egg-rr99.7%
div-inv99.7%
Applied egg-rr99.7%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ (tan y) (tan z))))
(if (or (<= (tan a) -0.005) (not (<= (tan a) 2e-42)))
(+ x (- t_0 (tan a)))
(+ x (- (/ t_0 (- 1.0 (* (tan y) (tan z)))) a)))))
double code(double x, double y, double z, double a) {
double t_0 = tan(y) + tan(z);
double tmp;
if ((tan(a) <= -0.005) || !(tan(a) <= 2e-42)) {
tmp = x + (t_0 - tan(a));
} else {
tmp = x + ((t_0 / (1.0 - (tan(y) * 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) :: t_0
real(8) :: tmp
t_0 = tan(y) + tan(z)
if ((tan(a) <= (-0.005d0)) .or. (.not. (tan(a) <= 2d-42))) then
tmp = x + (t_0 - tan(a))
else
tmp = x + ((t_0 / (1.0d0 - (tan(y) * tan(z)))) - 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.005) || !(Math.tan(a) <= 2e-42)) {
tmp = x + (t_0 - Math.tan(a));
} else {
tmp = x + ((t_0 / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
}
return tmp;
}
def code(x, y, z, a): t_0 = math.tan(y) + math.tan(z) tmp = 0 if (math.tan(a) <= -0.005) or not (math.tan(a) <= 2e-42): tmp = x + (t_0 - math.tan(a)) else: tmp = x + ((t_0 / (1.0 - (math.tan(y) * math.tan(z)))) - a) return tmp
function code(x, y, z, a) t_0 = Float64(tan(y) + tan(z)) tmp = 0.0 if ((tan(a) <= -0.005) || !(tan(a) <= 2e-42)) tmp = Float64(x + Float64(t_0 - tan(a))); else tmp = Float64(x + Float64(Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))) - 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.005) || ~((tan(a) <= 2e-42))) tmp = x + (t_0 - tan(a)); else tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - 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[Or[LessEqual[N[Tan[a], $MachinePrecision], -0.005], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 2e-42]], $MachinePrecision]], N[(x + N[(t$95$0 - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;\tan a \leq -0.005 \lor \neg \left(\tan a \leq 2 \cdot 10^{-42}\right):\\
\;\;\;\;x + \left(t\_0 - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\frac{t\_0}{1 - \tan y \cdot \tan z} - a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0050000000000000001 or 2.00000000000000008e-42 < (tan.f64 a) Initial program 81.0%
tan-sum99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 81.5%
remove-double-div81.5%
+-commutative81.5%
Applied egg-rr81.5%
if -0.0050000000000000001 < (tan.f64 a) < 2.00000000000000008e-42Initial program 76.0%
Taylor expanded in a around 0 76.0%
tan-sum99.8%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Final simplification90.4%
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ (tan y) (tan z))))
(if (<= (tan a) -0.005)
(+ x (- (/ 1.0 (/ 1.0 (+ (tan y) (/ 1.0 (/ (cos z) (sin z)))))) (tan a)))
(if (<= (tan a) 2e-42)
(+ 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.005) {
tmp = x + ((1.0 / (1.0 / (tan(y) + (1.0 / (cos(z) / sin(z)))))) - tan(a));
} else if (tan(a) <= 2e-42) {
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.005d0)) then
tmp = x + ((1.0d0 / (1.0d0 / (tan(y) + (1.0d0 / (cos(z) / sin(z)))))) - tan(a))
else if (tan(a) <= 2d-42) 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.005) {
tmp = x + ((1.0 / (1.0 / (Math.tan(y) + (1.0 / (Math.cos(z) / Math.sin(z)))))) - Math.tan(a));
} else if (Math.tan(a) <= 2e-42) {
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.005: tmp = x + ((1.0 / (1.0 / (math.tan(y) + (1.0 / (math.cos(z) / math.sin(z)))))) - math.tan(a)) elif math.tan(a) <= 2e-42: 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.005) tmp = Float64(x + Float64(Float64(1.0 / Float64(1.0 / Float64(tan(y) + Float64(1.0 / Float64(cos(z) / sin(z)))))) - tan(a))); elseif (tan(a) <= 2e-42) 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.005) tmp = x + ((1.0 / (1.0 / (tan(y) + (1.0 / (cos(z) / sin(z)))))) - tan(a)); elseif (tan(a) <= 2e-42) 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.005], N[(x + N[(N[(1.0 / N[(1.0 / N[(N[Tan[y], $MachinePrecision] + N[(1.0 / N[(N[Cos[z], $MachinePrecision] / N[Sin[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 2e-42], 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.005:\\
\;\;\;\;x + \left(\frac{1}{\frac{1}{\tan y + \frac{1}{\frac{\cos z}{\sin z}}}} - \tan a\right)\\
\mathbf{elif}\;\tan a \leq 2 \cdot 10^{-42}:\\
\;\;\;\;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) < -0.0050000000000000001Initial program 80.0%
tan-sum99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 80.2%
tan-quot80.2%
clear-num80.2%
Applied egg-rr80.2%
if -0.0050000000000000001 < (tan.f64 a) < 2.00000000000000008e-42Initial program 76.0%
Taylor expanded in a around 0 76.0%
tan-sum99.8%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
if 2.00000000000000008e-42 < (tan.f64 a) Initial program 82.0%
tan-sum99.6%
clear-num99.6%
Applied egg-rr99.6%
Taylor expanded in y around 0 82.8%
remove-double-div82.8%
+-commutative82.8%
Applied egg-rr82.8%
Final simplification90.4%
(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 78.6%
+-commutative78.6%
sub-neg78.6%
associate-+l+78.6%
tan-sum99.7%
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%
sub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z a) :precision binary64 (+ x (- (+ (tan y) (tan z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + ((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)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + ((Math.tan(y) + Math.tan(z)) - Math.tan(a));
}
def code(x, y, z, a): return x + ((math.tan(y) + math.tan(z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(Float64(tan(y) + tan(z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + ((tan(y) + tan(z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(\tan y + \tan z\right) - \tan a\right)
\end{array}
Initial program 78.6%
tan-sum99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 79.2%
remove-double-div79.2%
+-commutative79.2%
Applied egg-rr79.2%
Final simplification79.2%
(FPCore (x y z a) :precision binary64 (if (or (<= a -7.3e-14) (not (<= a 0.000135))) (+ x (- (tan y) (tan a))) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -7.3e-14) || !(a <= 0.000135)) {
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 <= (-7.3d-14)) .or. (.not. (a <= 0.000135d0))) 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 <= -7.3e-14) || !(a <= 0.000135)) {
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 <= -7.3e-14) or not (a <= 0.000135): 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 <= -7.3e-14) || !(a <= 0.000135)) 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 <= -7.3e-14) || ~((a <= 0.000135))) 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, -7.3e-14], N[Not[LessEqual[a, 0.000135]], $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 -7.3 \cdot 10^{-14} \lor \neg \left(a \leq 0.000135\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 < -7.30000000000000045e-14 or 1.35000000000000002e-4 < a Initial program 80.0%
Taylor expanded in y around inf 56.4%
if -7.30000000000000045e-14 < a < 1.35000000000000002e-4Initial program 77.2%
Taylor expanded in a around 0 77.2%
Final simplification66.6%
(FPCore (x y z a) :precision binary64 (if (<= z 6.8e-21) (+ x (- (tan y) (tan a))) (+ x (- (tan z) (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if (z <= 6.8e-21) {
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 (z <= 6.8d-21) 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 (z <= 6.8e-21) {
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 z <= 6.8e-21: 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 (z <= 6.8e-21) 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 (z <= 6.8e-21) 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[z, 6.8e-21], 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}\;z \leq 6.8 \cdot 10^{-21}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if z < 6.8e-21Initial program 85.2%
Taylor expanded in y around inf 70.2%
if 6.8e-21 < z Initial program 62.1%
Taylor expanded in y around 0 60.5%
(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 78.6%
(FPCore (x y z a) :precision binary64 (if (<= a -7.3e-14) x (if (<= a 1.55) (+ x (- (tan (+ y z)) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -7.3e-14) {
tmp = x;
} else if (a <= 1.55) {
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 <= (-7.3d-14)) then
tmp = x
else if (a <= 1.55d0) 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 <= -7.3e-14) {
tmp = x;
} else if (a <= 1.55) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -7.3e-14: tmp = x elif a <= 1.55: tmp = x + (math.tan((y + z)) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -7.3e-14) tmp = x; elseif (a <= 1.55) 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 <= -7.3e-14) tmp = x; elseif (a <= 1.55) tmp = x + (tan((y + z)) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -7.3e-14], x, If[LessEqual[a, 1.55], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.3 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.55:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -7.30000000000000045e-14 or 1.55000000000000004 < a Initial program 79.8%
Taylor expanded in x around inf 21.5%
if -7.30000000000000045e-14 < a < 1.55000000000000004Initial program 77.4%
Taylor expanded in a around 0 77.2%
(FPCore (x y z a) :precision binary64 (if (<= a -1.3e-49) x (if (<= a 1.55) (+ x (- (tan y) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.3e-49) {
tmp = x;
} else if (a <= 1.55) {
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.3d-49)) then
tmp = x
else if (a <= 1.55d0) 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.3e-49) {
tmp = x;
} else if (a <= 1.55) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if a <= -1.3e-49: tmp = x elif a <= 1.55: tmp = x + (math.tan(y) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (a <= -1.3e-49) tmp = x; elseif (a <= 1.55) 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.3e-49) tmp = x; elseif (a <= 1.55) tmp = x + (tan(y) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[a, -1.3e-49], x, If[LessEqual[a, 1.55], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{-49}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.55:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.29999999999999997e-49 or 1.55000000000000004 < a Initial program 79.5%
Taylor expanded in x around inf 22.7%
if -1.29999999999999997e-49 < a < 1.55000000000000004Initial program 77.6%
Taylor expanded in a around 0 77.5%
Taylor expanded in y around inf 58.2%
(FPCore (x y z a) :precision binary64 (if (<= z 2.75e-25) (+ x (- (tan y) a)) (+ x (- (tan z) a))))
double code(double x, double y, double z, double a) {
double tmp;
if (z <= 2.75e-25) {
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 <= 2.75d-25) 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 <= 2.75e-25) {
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 <= 2.75e-25: 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 <= 2.75e-25) 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 <= 2.75e-25) tmp = x + (tan(y) - a); else tmp = x + (tan(z) - a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[z, 2.75e-25], 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 2.75 \cdot 10^{-25}:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - a\right)\\
\end{array}
\end{array}
if z < 2.75000000000000002e-25Initial program 85.2%
Taylor expanded in a around 0 44.0%
Taylor expanded in y around inf 37.0%
if 2.75000000000000002e-25 < z Initial program 62.1%
Taylor expanded in a around 0 30.0%
Taylor expanded in y around 0 29.2%
(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 78.6%
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 78.6%
Taylor expanded in a around 0 40.0%
Taylor expanded in a around inf 3.4%
neg-mul-13.4%
Simplified3.4%
add-sqr-sqrt2.5%
sqrt-unprod4.6%
sqr-neg4.6%
sqrt-unprod2.4%
add-sqr-sqrt3.5%
*-un-lft-identity3.5%
Applied egg-rr3.5%
*-lft-identity3.5%
Simplified3.5%
herbie shell --seed 2024150
(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))))