
(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 (+ (- (/ (+ (tan y) (tan z)) (- 1.0 (/ (* (tan y) (sin z)) (cos z)))) (tan a)) x))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return (((tan(y) + tan(z)) / (1.0 - ((tan(y) * sin(z)) / cos(z)))) - tan(a)) + 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 = (((tan(y) + tan(z)) / (1.0d0 - ((tan(y) * sin(z)) / cos(z)))) - tan(a)) + x
end function
assert x < y && y < z && z < a;
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.sin(z)) / Math.cos(z)))) - Math.tan(a)) + x;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return (((math.tan(y) + math.tan(z)) / (1.0 - ((math.tan(y) * math.sin(z)) / math.cos(z)))) - math.tan(a)) + x
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(Float64(tan(y) * sin(z)) / cos(z)))) - tan(a)) + x) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = (((tan(y) + tan(z)) / (1.0 - ((tan(y) * sin(z)) / cos(z)))) - tan(a)) + x;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, a_] := N[(N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[(N[Tan[y], $MachinePrecision] * N[Sin[z], $MachinePrecision]), $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\left(\frac{\tan y + \tan z}{1 - \frac{\tan y \cdot \sin z}{\cos z}} - \tan a\right) + x
\end{array}
Initial program 80.3%
+-commutative80.3%
sub-neg80.3%
associate-+l+80.3%
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%
tan-quot99.7%
associate-*r/99.7%
Applied egg-rr99.7%
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 (- 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 / (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 / (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 / (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 / (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(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 / (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[(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, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \left(\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z} - \tan a\right)
\end{array}
Initial program 80.3%
tan-sum99.8%
div-inv99.8%
fmm-def99.8%
Applied egg-rr99.8%
fmm-undef99.8%
Simplified99.8%
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 80.3%
+-commutative80.3%
sub-neg80.3%
associate-+l+80.3%
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%
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 -0.00028)
(+ x (- (tan (+ y z)) (/ (sin a) (cos a))))
(if (<= a 0.0128)
(+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) a))
(+ x (+ (tan y) (- (tan z) (tan a)))))))assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -0.00028) {
tmp = x + (tan((y + z)) - (sin(a) / cos(a)));
} else if (a <= 0.0128) {
tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - a);
} else {
tmp = x + (tan(y) + (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 (a <= (-0.00028d0)) then
tmp = x + (tan((y + z)) - (sin(a) / cos(a)))
else if (a <= 0.0128d0) then
tmp = x + (((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) - a)
else
tmp = x + (tan(y) + (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 (a <= -0.00028) {
tmp = x + (Math.tan((y + z)) - (Math.sin(a) / Math.cos(a)));
} else if (a <= 0.0128) {
tmp = x + (((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
} else {
tmp = x + (Math.tan(y) + (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 a <= -0.00028: tmp = x + (math.tan((y + z)) - (math.sin(a) / math.cos(a))) elif a <= 0.0128: tmp = x + (((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) - a) else: tmp = x + (math.tan(y) + (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 (a <= -0.00028) tmp = Float64(x + Float64(tan(Float64(y + z)) - Float64(sin(a) / cos(a)))); elseif (a <= 0.0128) 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(y) + 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 (a <= -0.00028)
tmp = x + (tan((y + z)) - (sin(a) / cos(a)));
elseif (a <= 0.0128)
tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - a);
else
tmp = x + (tan(y) + (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[a, -0.00028], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sin[a], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.0128], 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[y], $MachinePrecision] + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.00028:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - \frac{\sin a}{\cos a}\right)\\
\mathbf{elif}\;a \leq 0.0128:\\
\;\;\;\;x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan y + \left(\tan z - \tan a\right)\right)\\
\end{array}
\end{array}
if a < -2.7999999999999998e-4Initial program 83.8%
Taylor expanded in a around inf 83.8%
if -2.7999999999999998e-4 < a < 0.0128000000000000006Initial program 76.8%
+-commutative76.8%
sub-neg76.8%
associate-+l+76.8%
tan-sum99.8%
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%
sub-neg99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in a around 0 99.1%
if 0.0128000000000000006 < a Initial program 84.0%
tan-sum99.7%
div-inv99.7%
fmm-def99.7%
Applied egg-rr99.7%
fmm-undef99.7%
Simplified99.7%
Taylor expanded in y around 0 84.2%
*-rgt-identity84.2%
associate-+r-84.0%
Applied egg-rr84.0%
associate-+r-84.2%
associate--l+84.2%
Simplified84.2%
Final simplification91.6%
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 (<= (tan a) -0.002) (not (<= (tan a) 0.24))) (+ x (- 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 ((tan(a) <= -0.002) || !(tan(a) <= 0.24)) {
tmp = x + (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 ((tan(a) <= (-0.002d0)) .or. (.not. (tan(a) <= 0.24d0))) then
tmp = x + (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 ((Math.tan(a) <= -0.002) || !(Math.tan(a) <= 0.24)) {
tmp = x + (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 (math.tan(a) <= -0.002) or not (math.tan(a) <= 0.24): tmp = x + (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 ((tan(a) <= -0.002) || !(tan(a) <= 0.24)) tmp = Float64(x + Float64(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 ((tan(a) <= -0.002) || ~((tan(a) <= 0.24)))
tmp = x + (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[N[Tan[a], $MachinePrecision], -0.002], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 0.24]], $MachinePrecision]], N[(x + N[(y - 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}\;\tan a \leq -0.002 \lor \neg \left(\tan a \leq 0.24\right):\\
\;\;\;\;x + \left(y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -2e-3 or 0.23999999999999999 < (tan.f64 a) Initial program 85.9%
add-cbrt-cube39.4%
pow1/319.9%
pow319.9%
Applied egg-rr19.9%
Taylor expanded in y around inf 30.2%
Taylor expanded in y around 0 36.1%
if -2e-3 < (tan.f64 a) < 0.23999999999999999Initial program 75.8%
Taylor expanded in a around 0 70.5%
Final simplification55.1%
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(tan(y) + Float64(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[Tan[y], $MachinePrecision] + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \left(\tan y + \left(\tan z - \tan a\right)\right)
\end{array}
Initial program 80.3%
tan-sum99.8%
div-inv99.8%
fmm-def99.8%
Applied egg-rr99.8%
fmm-undef99.8%
Simplified99.8%
Taylor expanded in y around 0 80.7%
*-rgt-identity80.7%
associate-+r-80.6%
Applied egg-rr80.6%
associate-+r-80.7%
associate--l+80.7%
Simplified80.7%
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 -5.5e-16) (not (<= a 0.0078))) (+ 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 <= -5.5e-16) || !(a <= 0.0078)) {
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 <= (-5.5d-16)) .or. (.not. (a <= 0.0078d0))) 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 <= -5.5e-16) || !(a <= 0.0078)) {
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 <= -5.5e-16) or not (a <= 0.0078): 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 <= -5.5e-16) || !(a <= 0.0078)) 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 <= -5.5e-16) || ~((a <= 0.0078)))
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, -5.5e-16], N[Not[LessEqual[a, 0.0078]], $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 -5.5 \cdot 10^{-16} \lor \neg \left(a \leq 0.0078\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.49999999999999964e-16 or 0.0077999999999999996 < a Initial program 82.5%
Taylor expanded in y around inf 62.3%
if -5.49999999999999964e-16 < a < 0.0077999999999999996Initial program 78.0%
Taylor expanded in a around 0 78.0%
Final simplification70.0%
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 5.8e-13) (+ 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 <= 5.8e-13) {
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 <= 5.8d-13) 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 <= 5.8e-13) {
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 <= 5.8e-13: 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 <= 5.8e-13) 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 <= 5.8e-13)
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, 5.8e-13], 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 5.8 \cdot 10^{-13}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if z < 5.7999999999999995e-13Initial program 87.4%
Taylor expanded in y around inf 72.7%
if 5.7999999999999995e-13 < z Initial program 59.1%
Taylor expanded in y around 0 58.8%
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 80.3%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (if (<= y -0.235) (+ x (- (tan y) a)) (if (<= y 9e-226) (+ x (- y (tan a))) (+ x (- (tan z) a)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (y <= -0.235) {
tmp = x + (tan(y) - a);
} else if (y <= 9e-226) {
tmp = x + (y - tan(a));
} else {
tmp = x + (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) :: tmp
if (y <= (-0.235d0)) then
tmp = x + (tan(y) - a)
else if (y <= 9d-226) then
tmp = x + (y - tan(a))
else
tmp = x + (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 tmp;
if (y <= -0.235) {
tmp = x + (Math.tan(y) - a);
} else if (y <= 9e-226) {
tmp = x + (y - Math.tan(a));
} else {
tmp = x + (Math.tan(z) - a);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if y <= -0.235: tmp = x + (math.tan(y) - a) elif y <= 9e-226: tmp = x + (y - math.tan(a)) else: tmp = x + (math.tan(z) - a) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (y <= -0.235) tmp = Float64(x + Float64(tan(y) - a)); elseif (y <= 9e-226) tmp = Float64(x + Float64(y - tan(a))); else tmp = Float64(x + Float64(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)
tmp = 0.0;
if (y <= -0.235)
tmp = x + (tan(y) - a);
elseif (y <= 9e-226)
tmp = x + (y - tan(a));
else
tmp = x + (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_] := If[LessEqual[y, -0.235], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e-226], N[(x + N[(y - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.235:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-226}:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - a\right)\\
\end{array}
\end{array}
if y < -0.23499999999999999Initial program 69.9%
Taylor expanded in a around 0 31.7%
Taylor expanded in y around inf 31.8%
if -0.23499999999999999 < y < 9.00000000000000023e-226Initial program 99.2%
add-cbrt-cube59.3%
pow1/332.2%
pow332.2%
Applied egg-rr32.2%
Taylor expanded in y around inf 40.8%
Taylor expanded in y around 0 61.0%
if 9.00000000000000023e-226 < y Initial program 71.9%
Taylor expanded in a around 0 39.7%
Taylor expanded in y around 0 32.8%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (if (<= y -0.075) (+ x (- (tan y) a)) (+ x (- y (tan a)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (y <= -0.075) {
tmp = x + (tan(y) - a);
} else {
tmp = x + (y - 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 (y <= (-0.075d0)) then
tmp = x + (tan(y) - a)
else
tmp = x + (y - 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 (y <= -0.075) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x + (y - Math.tan(a));
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if y <= -0.075: tmp = x + (math.tan(y) - a) else: tmp = x + (y - math.tan(a)) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (y <= -0.075) tmp = Float64(x + Float64(tan(y) - a)); else tmp = Float64(x + Float64(y - 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 (y <= -0.075)
tmp = x + (tan(y) - a);
else
tmp = x + (y - 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[y, -0.075], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.075:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\end{array}
\end{array}
if y < -0.0749999999999999972Initial program 69.9%
Taylor expanded in a around 0 31.7%
Taylor expanded in y around inf 31.8%
if -0.0749999999999999972 < y Initial program 83.3%
add-cbrt-cube44.8%
pow1/327.8%
pow327.8%
Applied egg-rr27.8%
Taylor expanded in y around inf 36.4%
Taylor expanded in y around 0 43.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 (<= y -1.2) x (+ x (- y (tan a)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (y <= -1.2) {
tmp = x;
} else {
tmp = x + (y - 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 (y <= (-1.2d0)) then
tmp = x
else
tmp = x + (y - 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 (y <= -1.2) {
tmp = x;
} else {
tmp = x + (y - Math.tan(a));
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if y <= -1.2: tmp = x else: tmp = x + (y - math.tan(a)) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (y <= -1.2) tmp = x; else tmp = Float64(x + Float64(y - 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 (y <= -1.2)
tmp = x;
else
tmp = x + (y - 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[y, -1.2], x, N[(x + N[(y - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\end{array}
\end{array}
if y < -1.19999999999999996Initial program 69.9%
Taylor expanded in x around inf 21.6%
if -1.19999999999999996 < y Initial program 83.3%
add-cbrt-cube44.8%
pow1/327.8%
pow327.8%
Applied egg-rr27.8%
Taylor expanded in y around inf 36.4%
Taylor expanded in y around 0 43.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 80.3%
Taylor expanded in x around inf 32.6%
herbie shell --seed 2024172
(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))))