
(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}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (+ x (- (/ (+ (tan y) (tan z)) (+ 1.0 (* (tan y) (* (sin z) (/ -1.0 (cos z)))))) (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + (((tan(y) + tan(z)) / (1.0 + (tan(y) * (sin(z) * (-1.0 / cos(z)))))) - tan(a));
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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) * (sin(z) * ((-1.0d0) / cos(z)))))) - tan(a))
end function
assert x < y && y < z && z < a;
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.sin(z) * (-1.0 / Math.cos(z)))))) - Math.tan(a));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + (((math.tan(y) + math.tan(z)) / (1.0 + (math.tan(y) * (math.sin(z) * (-1.0 / math.cos(z)))))) - math.tan(a))
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 + Float64(tan(y) * Float64(sin(z) * Float64(-1.0 / cos(z)))))) - tan(a))) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + (((tan(y) + tan(z)) / (1.0 + (tan(y) * (sin(z) * (-1.0 / cos(z)))))) - tan(a));
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. 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[(N[Sin[z], $MachinePrecision] * N[(-1.0 / N[Cos[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \left(\frac{\tan y + \tan z}{1 + \tan y \cdot \left(\sin z \cdot \frac{-1}{\cos z}\right)} - \tan a\right)
\end{array}
Initial program 79.9%
tan-sum99.6%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
tan-quot99.6%
div-inv99.6%
Applied egg-rr99.6%
Final simplification99.6%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) (tan a))))
assert(x < y && y < z && z < 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));
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < a;
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));
}
[x, y, z, a] = sort([x, y, z, 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))
x, y, z, a = sort([x, y, z, 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
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - tan(a));
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. 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, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)
\end{array}
Initial program 79.9%
tan-sum99.6%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ (tan y) (tan z))))
(if (or (<= a -0.00045) (not (<= a 0.022)))
(+ x (- t_0 (tan a)))
(+ x (- (* t_0 (/ 1.0 (- 1.0 (* (tan y) (tan z))))) a)))))assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double t_0 = tan(y) + tan(z);
double tmp;
if ((a <= -0.00045) || !(a <= 0.022)) {
tmp = x + (t_0 - tan(a));
} else {
tmp = x + ((t_0 * (1.0 / (1.0 - (tan(y) * tan(z))))) - a);
}
return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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 ((a <= (-0.00045d0)) .or. (.not. (a <= 0.022d0))) then
tmp = x + (t_0 - tan(a))
else
tmp = x + ((t_0 * (1.0d0 / (1.0d0 - (tan(y) * tan(z))))) - a)
end if
code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
double t_0 = Math.tan(y) + Math.tan(z);
double tmp;
if ((a <= -0.00045) || !(a <= 0.022)) {
tmp = x + (t_0 - Math.tan(a));
} else {
tmp = x + ((t_0 * (1.0 / (1.0 - (Math.tan(y) * Math.tan(z))))) - a);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): t_0 = math.tan(y) + math.tan(z) tmp = 0 if (a <= -0.00045) or not (a <= 0.022): tmp = x + (t_0 - math.tan(a)) else: tmp = x + ((t_0 * (1.0 / (1.0 - (math.tan(y) * math.tan(z))))) - a) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) t_0 = Float64(tan(y) + tan(z)) tmp = 0.0 if ((a <= -0.00045) || !(a <= 0.022)) tmp = Float64(x + Float64(t_0 - tan(a))); else tmp = Float64(x + Float64(Float64(t_0 * Float64(1.0 / Float64(1.0 - Float64(tan(y) * tan(z))))) - a)); end return tmp end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
t_0 = tan(y) + tan(z);
tmp = 0.0;
if ((a <= -0.00045) || ~((a <= 0.022)))
tmp = x + (t_0 - tan(a));
else
tmp = x + ((t_0 * (1.0 / (1.0 - (tan(y) * tan(z))))) - a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[a, -0.00045], N[Not[LessEqual[a, 0.022]], $MachinePrecision]], N[(x + N[(t$95$0 - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t$95$0 * N[(1.0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;a \leq -0.00045 \lor \neg \left(a \leq 0.022\right):\\
\;\;\;\;x + \left(t\_0 - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t\_0 \cdot \frac{1}{1 - \tan y \cdot \tan z} - a\right)\\
\end{array}
\end{array}
if a < -4.4999999999999999e-4 or 0.021999999999999999 < a Initial program 84.6%
tan-sum99.6%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
expm1-log1p-u93.0%
expm1-undefine92.9%
log1p-undefine92.9%
add-exp-log99.5%
Applied egg-rr99.5%
associate--l+99.6%
fma-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 85.1%
if -4.4999999999999999e-4 < a < 0.021999999999999999Initial program 75.6%
Taylor expanded in a around 0 75.6%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.3%
Final simplification92.6%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (+ (tan y) (tan z))))
(if (or (<= a -0.00068) (not (<= a 0.022)))
(+ x (- t_0 (tan a)))
(+ x (- (/ t_0 (- 1.0 (* (tan y) (tan z)))) a)))))assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double t_0 = tan(y) + tan(z);
double tmp;
if ((a <= -0.00068) || !(a <= 0.022)) {
tmp = x + (t_0 - tan(a));
} else {
tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - a);
}
return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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 ((a <= (-0.00068d0)) .or. (.not. (a <= 0.022d0))) 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
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
double t_0 = Math.tan(y) + Math.tan(z);
double tmp;
if ((a <= -0.00068) || !(a <= 0.022)) {
tmp = x + (t_0 - Math.tan(a));
} else {
tmp = x + ((t_0 / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): t_0 = math.tan(y) + math.tan(z) tmp = 0 if (a <= -0.00068) or not (a <= 0.022): tmp = x + (t_0 - math.tan(a)) else: tmp = x + ((t_0 / (1.0 - (math.tan(y) * math.tan(z)))) - a) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) t_0 = Float64(tan(y) + tan(z)) tmp = 0.0 if ((a <= -0.00068) || !(a <= 0.022)) 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
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
t_0 = tan(y) + tan(z);
tmp = 0.0;
if ((a <= -0.00068) || ~((a <= 0.022)))
tmp = x + (t_0 - tan(a));
else
tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[a, -0.00068], N[Not[LessEqual[a, 0.022]], $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}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;a \leq -0.00068 \lor \neg \left(a \leq 0.022\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 a < -6.8e-4 or 0.021999999999999999 < a Initial program 84.6%
tan-sum99.6%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
expm1-log1p-u93.0%
expm1-undefine92.9%
log1p-undefine92.9%
add-exp-log99.5%
Applied egg-rr99.5%
associate--l+99.6%
fma-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 85.1%
if -6.8e-4 < a < 0.021999999999999999Initial program 75.6%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in a around 0 99.3%
Final simplification92.6%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (+ x (- (+ (tan y) (tan z)) (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + ((tan(y) + tan(z)) - tan(a));
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
return x + ((Math.tan(y) + Math.tan(z)) - Math.tan(a));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + ((math.tan(y) + math.tan(z)) - math.tan(a))
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x + Float64(Float64(tan(y) + tan(z)) - tan(a))) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + ((tan(y) + tan(z)) - tan(a));
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. 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, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \left(\left(\tan y + \tan z\right) - \tan a\right)
\end{array}
Initial program 79.9%
tan-sum99.6%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
expm1-log1p-u92.2%
expm1-undefine92.2%
log1p-undefine92.2%
add-exp-log99.6%
Applied egg-rr99.6%
associate--l+99.6%
fma-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 80.5%
Final simplification80.5%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (if (or (<= a -0.0005) (not (<= a 0.022))) (+ x (- (tan y) (tan a))) (+ x (- (tan (+ y z)) a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -0.0005) || !(a <= 0.022)) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = x + (tan((y + z)) - a);
}
return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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.0005d0)) .or. (.not. (a <= 0.022d0))) then
tmp = x + (tan(y) - tan(a))
else
tmp = x + (tan((y + z)) - a)
end if
code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -0.0005) || !(a <= 0.022)) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = x + (Math.tan((y + z)) - a);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if (a <= -0.0005) or not (a <= 0.022): tmp = x + (math.tan(y) - math.tan(a)) else: tmp = x + (math.tan((y + z)) - a) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if ((a <= -0.0005) || !(a <= 0.022)) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); end return tmp end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
tmp = 0.0;
if ((a <= -0.0005) || ~((a <= 0.022)))
tmp = x + (tan(y) - tan(a));
else
tmp = x + (tan((y + z)) - a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, a_] := If[Or[LessEqual[a, -0.0005], N[Not[LessEqual[a, 0.022]], $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}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0005 \lor \neg \left(a \leq 0.022\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 < -5.0000000000000001e-4 or 0.021999999999999999 < a Initial program 84.6%
Taylor expanded in y around inf 64.1%
if -5.0000000000000001e-4 < a < 0.021999999999999999Initial program 75.6%
Taylor expanded in a around 0 75.6%
Final simplification70.2%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (let* ((t_0 (pow (pow x 0.3333333333333333) 3.0))) (if (<= a -1.55) t_0 (if (<= a 4.6e-19) (+ x (- (tan (+ y z)) a)) t_0))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double t_0 = pow(pow(x, 0.3333333333333333), 3.0);
double tmp;
if (a <= -1.55) {
tmp = t_0;
} else if (a <= 4.6e-19) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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 = (x ** 0.3333333333333333d0) ** 3.0d0
if (a <= (-1.55d0)) then
tmp = t_0
else if (a <= 4.6d-19) then
tmp = x + (tan((y + z)) - a)
else
tmp = t_0
end if
code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
double t_0 = Math.pow(Math.pow(x, 0.3333333333333333), 3.0);
double tmp;
if (a <= -1.55) {
tmp = t_0;
} else if (a <= 4.6e-19) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = t_0;
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): t_0 = math.pow(math.pow(x, 0.3333333333333333), 3.0) tmp = 0 if a <= -1.55: tmp = t_0 elif a <= 4.6e-19: tmp = x + (math.tan((y + z)) - a) else: tmp = t_0 return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) t_0 = (x ^ 0.3333333333333333) ^ 3.0 tmp = 0.0 if (a <= -1.55) tmp = t_0; elseif (a <= 4.6e-19) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = t_0; end return tmp end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
t_0 = (x ^ 0.3333333333333333) ^ 3.0;
tmp = 0.0;
if (a <= -1.55)
tmp = t_0;
elseif (a <= 4.6e-19)
tmp = x + (tan((y + z)) - a);
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := Block[{t$95$0 = N[Power[N[Power[x, 0.3333333333333333], $MachinePrecision], 3.0], $MachinePrecision]}, If[LessEqual[a, -1.55], t$95$0, If[LessEqual[a, 4.6e-19], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
t_0 := {\left({x}^{0.3333333333333333}\right)}^{3}\\
\mathbf{if}\;a \leq -1.55:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 4.6 \cdot 10^{-19}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -1.55000000000000004 or 4.5999999999999996e-19 < a Initial program 83.7%
add-cube-cbrt82.4%
pow382.3%
+-commutative82.3%
associate-+l-82.4%
Applied egg-rr82.4%
Taylor expanded in x around inf 22.5%
pow1/322.5%
Applied egg-rr22.5%
if -1.55000000000000004 < a < 4.5999999999999996e-19Initial program 76.4%
Taylor expanded in a around 0 76.4%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (if (<= a -2.1) (exp (log x)) (if (<= a 4.6e-19) (+ x (- (tan (+ y z)) a)) (* (sqrt x) (sqrt x)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -2.1) {
tmp = exp(log(x));
} else if (a <= 4.6e-19) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = sqrt(x) * sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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 <= (-2.1d0)) then
tmp = exp(log(x))
else if (a <= 4.6d-19) then
tmp = x + (tan((y + z)) - a)
else
tmp = sqrt(x) * sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -2.1) {
tmp = Math.exp(Math.log(x));
} else if (a <= 4.6e-19) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = Math.sqrt(x) * Math.sqrt(x);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if a <= -2.1: tmp = math.exp(math.log(x)) elif a <= 4.6e-19: tmp = x + (math.tan((y + z)) - a) else: tmp = math.sqrt(x) * math.sqrt(x) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (a <= -2.1) tmp = exp(log(x)); elseif (a <= 4.6e-19) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = Float64(sqrt(x) * sqrt(x)); end return tmp end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
tmp = 0.0;
if (a <= -2.1)
tmp = exp(log(x));
elseif (a <= 4.6e-19)
tmp = x + (tan((y + z)) - a);
else
tmp = sqrt(x) * sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, a_] := If[LessEqual[a, -2.1], N[Exp[N[Log[x], $MachinePrecision]], $MachinePrecision], If[LessEqual[a, 4.6e-19], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1:\\
\;\;\;\;e^{\log x}\\
\mathbf{elif}\;a \leq 4.6 \cdot 10^{-19}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \sqrt{x}\\
\end{array}
\end{array}
if a < -2.10000000000000009Initial program 84.7%
add-cube-cbrt83.3%
pow383.2%
+-commutative83.2%
associate-+l-83.2%
Applied egg-rr83.2%
Taylor expanded in x around inf 23.7%
rem-cube-cbrt23.7%
add-exp-log23.7%
Applied egg-rr23.7%
if -2.10000000000000009 < a < 4.5999999999999996e-19Initial program 76.4%
Taylor expanded in a around 0 76.4%
if 4.5999999999999996e-19 < a Initial program 82.5%
add-cube-cbrt81.3%
pow381.4%
+-commutative81.4%
associate-+l-81.5%
Applied egg-rr81.5%
Taylor expanded in x around inf 21.2%
rem-cube-cbrt21.2%
add-sqr-sqrt21.2%
Applied egg-rr21.2%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (if (<= z 1.45e-10) (+ x (- (tan y) (tan a))) (+ x (- (tan z) (tan a)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (z <= 1.45e-10) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = x + (tan(z) - tan(a));
}
return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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 <= 1.45d-10) then
tmp = x + (tan(y) - tan(a))
else
tmp = x + (tan(z) - tan(a))
end if
code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
double tmp;
if (z <= 1.45e-10) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = x + (Math.tan(z) - Math.tan(a));
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if z <= 1.45e-10: tmp = x + (math.tan(y) - math.tan(a)) else: tmp = x + (math.tan(z) - math.tan(a)) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (z <= 1.45e-10) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(x + Float64(tan(z) - tan(a))); end return tmp end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
tmp = 0.0;
if (z <= 1.45e-10)
tmp = x + (tan(y) - tan(a));
else
tmp = x + (tan(z) - tan(a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, a_] := If[LessEqual[z, 1.45e-10], 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}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.45 \cdot 10^{-10}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if z < 1.4499999999999999e-10Initial program 85.7%
Taylor expanded in y around inf 74.5%
if 1.4499999999999999e-10 < z Initial program 66.2%
Taylor expanded in y around 0 66.2%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + (tan((y + z)) - tan(a));
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. 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, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
Initial program 79.9%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (if (<= a -1.96) (exp (log x)) (if (<= a 4.6e-19) (+ x (- (tan (+ y z)) a)) x)))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.96) {
tmp = exp(log(x));
} else if (a <= 4.6e-19) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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.96d0)) then
tmp = exp(log(x))
else if (a <= 4.6d-19) then
tmp = x + (tan((y + z)) - a)
else
tmp = x
end if
code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.96) {
tmp = Math.exp(Math.log(x));
} else if (a <= 4.6e-19) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if a <= -1.96: tmp = math.exp(math.log(x)) elif a <= 4.6e-19: tmp = x + (math.tan((y + z)) - a) else: tmp = x return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (a <= -1.96) tmp = exp(log(x)); elseif (a <= 4.6e-19) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = x; end return tmp end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
tmp = 0.0;
if (a <= -1.96)
tmp = exp(log(x));
elseif (a <= 4.6e-19)
tmp = x + (tan((y + z)) - a);
else
tmp = x;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, a_] := If[LessEqual[a, -1.96], N[Exp[N[Log[x], $MachinePrecision]], $MachinePrecision], If[LessEqual[a, 4.6e-19], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.96:\\
\;\;\;\;e^{\log x}\\
\mathbf{elif}\;a \leq 4.6 \cdot 10^{-19}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.96Initial program 84.7%
add-cube-cbrt83.3%
pow383.2%
+-commutative83.2%
associate-+l-83.2%
Applied egg-rr83.2%
Taylor expanded in x around inf 23.7%
rem-cube-cbrt23.7%
add-exp-log23.7%
Applied egg-rr23.7%
if -1.96 < a < 4.5999999999999996e-19Initial program 76.4%
Taylor expanded in a around 0 76.4%
if 4.5999999999999996e-19 < a Initial program 82.5%
Taylor expanded in x around inf 21.2%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (if (<= a -1.96) x (if (<= a 4.6e-19) (+ x (- (tan (+ y z)) a)) x)))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.96) {
tmp = x;
} else if (a <= 4.6e-19) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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.96d0)) then
tmp = x
else if (a <= 4.6d-19) then
tmp = x + (tan((y + z)) - a)
else
tmp = x
end if
code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.96) {
tmp = x;
} else if (a <= 4.6e-19) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if a <= -1.96: tmp = x elif a <= 4.6e-19: tmp = x + (math.tan((y + z)) - a) else: tmp = x return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (a <= -1.96) tmp = x; elseif (a <= 4.6e-19) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = x; end return tmp end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
tmp = 0.0;
if (a <= -1.96)
tmp = x;
elseif (a <= 4.6e-19)
tmp = x + (tan((y + z)) - a);
else
tmp = x;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, a_] := If[LessEqual[a, -1.96], x, If[LessEqual[a, 4.6e-19], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.96:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.6 \cdot 10^{-19}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.96 or 4.5999999999999996e-19 < a Initial program 83.7%
Taylor expanded in x around inf 22.5%
if -1.96 < a < 4.5999999999999996e-19Initial program 76.4%
Taylor expanded in a around 0 76.4%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 x)
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
return x;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return x end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, a_] := x
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x
\end{array}
Initial program 79.9%
Taylor expanded in x around inf 31.2%
herbie shell --seed 2024113
(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))))