
(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 16 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
(-
(/
1.0
(/ (+ 1.0 (* (tan z) (/ -1.0 (/ (cos y) (sin y))))) (+ (tan z) (tan y))))
(tan a))))assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + ((1.0 / ((1.0 + (tan(z) * (-1.0 / (cos(y) / sin(y))))) / (tan(z) + tan(y)))) - 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 + ((1.0d0 / ((1.0d0 + (tan(z) * ((-1.0d0) / (cos(y) / sin(y))))) / (tan(z) + tan(y)))) - 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 + ((1.0 / ((1.0 + (Math.tan(z) * (-1.0 / (Math.cos(y) / Math.sin(y))))) / (Math.tan(z) + Math.tan(y)))) - Math.tan(a));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + ((1.0 / ((1.0 + (math.tan(z) * (-1.0 / (math.cos(y) / math.sin(y))))) / (math.tan(z) + math.tan(y)))) - math.tan(a))
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x + Float64(Float64(1.0 / Float64(Float64(1.0 + Float64(tan(z) * Float64(-1.0 / Float64(cos(y) / sin(y))))) / Float64(tan(z) + tan(y)))) - tan(a))) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + ((1.0 / ((1.0 + (tan(z) * (-1.0 / (cos(y) / sin(y))))) / (tan(z) + tan(y)))) - 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[(1.0 / N[(N[(1.0 + N[(N[Tan[z], $MachinePrecision] * N[(-1.0 / N[(N[Cos[y], $MachinePrecision] / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $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{1}{\frac{1 + \tan z \cdot \frac{-1}{\frac{\cos y}{\sin y}}}{\tan z + \tan y}} - \tan a\right)
\end{array}
Initial program 78.6%
tan-sum99.7%
clear-num99.7%
Applied egg-rr99.7%
tan-quot99.7%
frac-2neg99.7%
Applied egg-rr99.7%
clear-num99.7%
inv-pow99.7%
Applied egg-rr99.7%
unpow-199.7%
distribute-frac-neg299.7%
distribute-neg-frac99.7%
remove-double-neg99.7%
Simplified99.7%
Final simplification99.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 (<= (tan a) -0.001) (not (<= (tan a) 1e-32))) (+ x (- (tan (+ y z)) (tan a))) (+ x (- (/ 1.0 (/ (- 1.0 (* (tan z) (tan y))) (+ (tan z) (tan y)))) a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if ((tan(a) <= -0.001) || !(tan(a) <= 1e-32)) {
tmp = x + (tan((y + z)) - tan(a));
} else {
tmp = x + ((1.0 / ((1.0 - (tan(z) * tan(y))) / (tan(z) + tan(y)))) - 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.001d0)) .or. (.not. (tan(a) <= 1d-32))) then
tmp = x + (tan((y + z)) - tan(a))
else
tmp = x + ((1.0d0 / ((1.0d0 - (tan(z) * tan(y))) / (tan(z) + tan(y)))) - 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.001) || !(Math.tan(a) <= 1e-32)) {
tmp = x + (Math.tan((y + z)) - Math.tan(a));
} else {
tmp = x + ((1.0 / ((1.0 - (Math.tan(z) * Math.tan(y))) / (Math.tan(z) + Math.tan(y)))) - 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.001) or not (math.tan(a) <= 1e-32): tmp = x + (math.tan((y + z)) - math.tan(a)) else: tmp = x + ((1.0 / ((1.0 - (math.tan(z) * math.tan(y))) / (math.tan(z) + math.tan(y)))) - 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.001) || !(tan(a) <= 1e-32)) tmp = Float64(x + Float64(tan(Float64(y + z)) - tan(a))); else tmp = Float64(x + Float64(Float64(1.0 / Float64(Float64(1.0 - Float64(tan(z) * tan(y))) / Float64(tan(z) + tan(y)))) - 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.001) || ~((tan(a) <= 1e-32)))
tmp = x + (tan((y + z)) - tan(a));
else
tmp = x + ((1.0 / ((1.0 - (tan(z) * tan(y))) / (tan(z) + tan(y)))) - 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.001], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 1e-32]], $MachinePrecision]], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 / N[(N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision]), $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.001 \lor \neg \left(\tan a \leq 10^{-32}\right):\\
\;\;\;\;x + \left(\tan \left(y + z\right) - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\frac{1}{\frac{1 - \tan z \cdot \tan y}{\tan z + \tan y}} - a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -1e-3 or 1.00000000000000006e-32 < (tan.f64 a) Initial program 78.3%
if -1e-3 < (tan.f64 a) < 1.00000000000000006e-32Initial program 78.8%
Taylor expanded in a around 0 78.8%
tan-sum99.7%
clear-num99.8%
Applied egg-rr99.8%
Final simplification88.1%
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.001) (not (<= (tan a) 1e-32))) (+ x (- (tan (+ y z)) (tan a))) (+ x (- (* (+ (tan z) (tan y)) (/ 1.0 (- 1.0 (* (tan z) (tan y))))) a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if ((tan(a) <= -0.001) || !(tan(a) <= 1e-32)) {
tmp = x + (tan((y + z)) - tan(a));
} else {
tmp = x + (((tan(z) + tan(y)) * (1.0 / (1.0 - (tan(z) * tan(y))))) - 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.001d0)) .or. (.not. (tan(a) <= 1d-32))) then
tmp = x + (tan((y + z)) - tan(a))
else
tmp = x + (((tan(z) + tan(y)) * (1.0d0 / (1.0d0 - (tan(z) * tan(y))))) - 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.001) || !(Math.tan(a) <= 1e-32)) {
tmp = x + (Math.tan((y + z)) - Math.tan(a));
} else {
tmp = x + (((Math.tan(z) + Math.tan(y)) * (1.0 / (1.0 - (Math.tan(z) * Math.tan(y))))) - 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.001) or not (math.tan(a) <= 1e-32): tmp = x + (math.tan((y + z)) - math.tan(a)) else: tmp = x + (((math.tan(z) + math.tan(y)) * (1.0 / (1.0 - (math.tan(z) * math.tan(y))))) - 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.001) || !(tan(a) <= 1e-32)) tmp = Float64(x + Float64(tan(Float64(y + z)) - tan(a))); else tmp = Float64(x + Float64(Float64(Float64(tan(z) + tan(y)) * Float64(1.0 / Float64(1.0 - Float64(tan(z) * tan(y))))) - 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.001) || ~((tan(a) <= 1e-32)))
tmp = x + (tan((y + z)) - tan(a));
else
tmp = x + (((tan(z) + tan(y)) * (1.0 / (1.0 - (tan(z) * tan(y))))) - 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.001], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 1e-32]], $MachinePrecision]], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.001 \lor \neg \left(\tan a \leq 10^{-32}\right):\\
\;\;\;\;x + \left(\tan \left(y + z\right) - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(\tan z + \tan y\right) \cdot \frac{1}{1 - \tan z \cdot \tan y} - a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -1e-3 or 1.00000000000000006e-32 < (tan.f64 a) Initial program 78.3%
if -1e-3 < (tan.f64 a) < 1.00000000000000006e-32Initial program 78.8%
Taylor expanded in a around 0 78.8%
tan-sum99.7%
div-inv99.8%
Applied egg-rr99.8%
Final simplification88.1%
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.001) (not (<= (tan a) 1e-32))) (+ x (- (tan (+ y z)) (tan a))) (+ x (- (/ (+ (tan z) (tan y)) (- 1.0 (* (tan z) (tan y)))) a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if ((tan(a) <= -0.001) || !(tan(a) <= 1e-32)) {
tmp = x + (tan((y + z)) - tan(a));
} else {
tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - 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.001d0)) .or. (.not. (tan(a) <= 1d-32))) then
tmp = x + (tan((y + z)) - tan(a))
else
tmp = x + (((tan(z) + tan(y)) / (1.0d0 - (tan(z) * tan(y)))) - 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.001) || !(Math.tan(a) <= 1e-32)) {
tmp = x + (Math.tan((y + z)) - Math.tan(a));
} else {
tmp = x + (((Math.tan(z) + Math.tan(y)) / (1.0 - (Math.tan(z) * Math.tan(y)))) - 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.001) or not (math.tan(a) <= 1e-32): tmp = x + (math.tan((y + z)) - math.tan(a)) else: tmp = x + (((math.tan(z) + math.tan(y)) / (1.0 - (math.tan(z) * math.tan(y)))) - 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.001) || !(tan(a) <= 1e-32)) tmp = Float64(x + Float64(tan(Float64(y + z)) - tan(a))); else tmp = Float64(x + Float64(Float64(Float64(tan(z) + tan(y)) / Float64(1.0 - Float64(tan(z) * tan(y)))) - 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.001) || ~((tan(a) <= 1e-32)))
tmp = x + (tan((y + z)) - tan(a));
else
tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - 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.001], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 1e-32]], $MachinePrecision]], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $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.001 \lor \neg \left(\tan a \leq 10^{-32}\right):\\
\;\;\;\;x + \left(\tan \left(y + z\right) - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\frac{\tan z + \tan y}{1 - \tan z \cdot \tan y} - a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -1e-3 or 1.00000000000000006e-32 < (tan.f64 a) Initial program 78.3%
if -1e-3 < (tan.f64 a) < 1.00000000000000006e-32Initial program 78.8%
Taylor expanded in a around 0 78.8%
tan-sum99.7%
div-inv99.8%
fma-neg99.8%
+-commutative99.8%
*-commutative99.8%
Applied egg-rr99.8%
fma-undefine99.8%
unsub-neg99.8%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification88.0%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (+ x (- (/ 1.0 (/ (- 1.0 (* (tan z) (tan y))) (+ (tan z) (tan y)))) (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + ((1.0 / ((1.0 - (tan(z) * tan(y))) / (tan(z) + tan(y)))) - 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 + ((1.0d0 / ((1.0d0 - (tan(z) * tan(y))) / (tan(z) + tan(y)))) - 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 + ((1.0 / ((1.0 - (Math.tan(z) * Math.tan(y))) / (Math.tan(z) + Math.tan(y)))) - Math.tan(a));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + ((1.0 / ((1.0 - (math.tan(z) * math.tan(y))) / (math.tan(z) + math.tan(y)))) - math.tan(a))
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x + Float64(Float64(1.0 / Float64(Float64(1.0 - Float64(tan(z) * tan(y))) / Float64(tan(z) + tan(y)))) - tan(a))) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + ((1.0 / ((1.0 - (tan(z) * tan(y))) / (tan(z) + tan(y)))) - 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[(1.0 / N[(N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Tan[z], $MachinePrecision] + N[Tan[y], $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{1}{\frac{1 - \tan z \cdot \tan y}{\tan z + \tan y}} - \tan a\right)
\end{array}
Initial program 78.6%
tan-sum99.7%
clear-num99.7%
Applied egg-rr99.7%
Final simplification99.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 z) (tan y)) (/ 1.0 (- 1.0 (* (tan z) (tan y))))) (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + (((tan(z) + tan(y)) * (1.0 / (1.0 - (tan(z) * tan(y))))) - 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(z) + tan(y)) * (1.0d0 / (1.0d0 - (tan(z) * tan(y))))) - 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(z) + Math.tan(y)) * (1.0 / (1.0 - (Math.tan(z) * Math.tan(y))))) - Math.tan(a));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + (((math.tan(z) + math.tan(y)) * (1.0 / (1.0 - (math.tan(z) * math.tan(y))))) - 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(z) + tan(y)) * Float64(1.0 / Float64(1.0 - Float64(tan(z) * tan(y))))) - tan(a))) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + (((tan(z) + tan(y)) * (1.0 / (1.0 - (tan(z) * tan(y))))) - 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[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $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 z + \tan y\right) \cdot \frac{1}{1 - \tan z \cdot \tan y} - \tan a\right)
\end{array}
Initial program 78.6%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
Final simplification99.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 z) (tan y)) (- 1.0 (* (tan z) (tan y)))) (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - 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(z) + tan(y)) / (1.0d0 - (tan(z) * tan(y)))) - 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(z) + Math.tan(y)) / (1.0 - (Math.tan(z) * Math.tan(y)))) - Math.tan(a));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + (((math.tan(z) + math.tan(y)) / (1.0 - (math.tan(z) * math.tan(y)))) - 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(z) + tan(y)) / Float64(1.0 - Float64(tan(z) * tan(y)))) - tan(a))) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + (((tan(z) + tan(y)) / (1.0 - (tan(z) * tan(y)))) - 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[z], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[z], $MachinePrecision] * N[Tan[y], $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 z + \tan y}{1 - \tan z \cdot \tan y} - \tan a\right)
\end{array}
Initial program 78.6%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.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 (<= (tan a) -0.001) (not (<= (tan a) 0.005))) (+ 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 ((tan(a) <= -0.001) || !(tan(a) <= 0.005)) {
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 ((tan(a) <= (-0.001d0)) .or. (.not. (tan(a) <= 0.005d0))) 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 ((Math.tan(a) <= -0.001) || !(Math.tan(a) <= 0.005)) {
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 (math.tan(a) <= -0.001) or not (math.tan(a) <= 0.005): 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 ((tan(a) <= -0.001) || !(tan(a) <= 0.005)) 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 ((tan(a) <= -0.001) || ~((tan(a) <= 0.005)))
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[N[Tan[a], $MachinePrecision], -0.001], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 0.005]], $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}\;\tan a \leq -0.001 \lor \neg \left(\tan a \leq 0.005\right):\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -1e-3 or 0.0050000000000000001 < (tan.f64 a) Initial program 77.4%
Taylor expanded in y around inf 57.4%
if -1e-3 < (tan.f64 a) < 0.0050000000000000001Initial program 79.8%
Taylor expanded in a around 0 79.4%
Final simplification67.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 (or (<= a -0.075) (not (<= a 0.058))) (+ x (- (sin z) (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.075) || !(a <= 0.058)) {
tmp = x + (sin(z) - 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.075d0)) .or. (.not. (a <= 0.058d0))) then
tmp = x + (sin(z) - 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.075) || !(a <= 0.058)) {
tmp = x + (Math.sin(z) - 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.075) or not (a <= 0.058): tmp = x + (math.sin(z) - 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.075) || !(a <= 0.058)) tmp = Float64(x + Float64(sin(z) - 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.075) || ~((a <= 0.058)))
tmp = x + (sin(z) - 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.075], N[Not[LessEqual[a, 0.058]], $MachinePrecision]], N[(x + N[(N[Sin[z], $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.075 \lor \neg \left(a \leq 0.058\right):\\
\;\;\;\;x + \left(\sin z - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
if a < -0.0749999999999999972 or 0.0580000000000000029 < a Initial program 77.2%
+-commutative77.2%
sub-neg77.2%
associate-+l+77.1%
tan-quot77.1%
div-inv77.1%
fma-define77.1%
neg-mul-177.1%
fma-define77.1%
Applied egg-rr77.1%
fma-undefine77.1%
fma-undefine77.1%
neg-mul-177.1%
associate-*r/77.1%
*-rgt-identity77.1%
+-commutative77.1%
+-commutative77.1%
+-commutative77.1%
sub-neg77.1%
Simplified77.1%
Taylor expanded in z around 0 58.0%
Taylor expanded in y around 0 40.0%
associate--l+40.0%
Simplified40.0%
tan-quot40.1%
*-un-lft-identity40.1%
Applied egg-rr40.1%
*-lft-identity40.1%
Simplified40.1%
if -0.0749999999999999972 < a < 0.0580000000000000029Initial program 80.0%
Taylor expanded in a around 0 79.4%
Final simplification59.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.6e-14) (+ 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.6e-14) {
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.6d-14) 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.6e-14) {
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.6e-14: 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.6e-14) 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.6e-14)
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.6e-14], 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.6 \cdot 10^{-14}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if z < 5.6000000000000001e-14Initial program 86.8%
Taylor expanded in y around inf 72.6%
if 5.6000000000000001e-14 < z Initial program 57.8%
Taylor expanded in y around 0 56.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 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 78.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 (<= a -1.9) x (if (<= a 1.55) (+ x (- (tan (+ y z)) a)) (+ x (sin z)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.9) {
tmp = x;
} else if (a <= 1.55) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = x + sin(z);
}
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.9d0)) then
tmp = x
else if (a <= 1.55d0) then
tmp = x + (tan((y + z)) - a)
else
tmp = x + sin(z)
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.9) {
tmp = x;
} else if (a <= 1.55) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x + Math.sin(z);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if a <= -1.9: tmp = x elif a <= 1.55: tmp = x + (math.tan((y + z)) - a) else: tmp = x + math.sin(z) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (a <= -1.9) tmp = x; elseif (a <= 1.55) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = Float64(x + sin(z)); 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.9)
tmp = x;
elseif (a <= 1.55)
tmp = x + (tan((y + z)) - a);
else
tmp = x + sin(z);
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.9], x, If[LessEqual[a, 1.55], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[z], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.55:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \sin z\\
\end{array}
\end{array}
if a < -1.8999999999999999Initial program 75.8%
Taylor expanded in x around inf 22.9%
if -1.8999999999999999 < a < 1.55000000000000004Initial program 80.0%
Taylor expanded in a around 0 79.4%
if 1.55000000000000004 < a Initial program 78.4%
+-commutative78.4%
sub-neg78.4%
associate-+l+78.3%
tan-quot78.3%
div-inv78.3%
fma-define78.3%
neg-mul-178.3%
fma-define78.3%
Applied egg-rr78.3%
fma-undefine78.3%
fma-undefine78.3%
neg-mul-178.3%
associate-*r/78.3%
*-rgt-identity78.3%
+-commutative78.3%
+-commutative78.3%
+-commutative78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in z around 0 58.6%
Taylor expanded in y around 0 41.3%
associate--l+41.3%
Simplified41.3%
Taylor expanded in a around 0 21.9%
+-commutative21.9%
Simplified21.9%
Final simplification49.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.31) x (if (<= a 2.7) (+ x (+ a (tan (+ y z)))) (+ x (sin z)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -0.31) {
tmp = x;
} else if (a <= 2.7) {
tmp = x + (a + tan((y + z)));
} else {
tmp = x + sin(z);
}
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.31d0)) then
tmp = x
else if (a <= 2.7d0) then
tmp = x + (a + tan((y + z)))
else
tmp = x + sin(z)
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.31) {
tmp = x;
} else if (a <= 2.7) {
tmp = x + (a + Math.tan((y + z)));
} else {
tmp = x + Math.sin(z);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if a <= -0.31: tmp = x elif a <= 2.7: tmp = x + (a + math.tan((y + z))) else: tmp = x + math.sin(z) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (a <= -0.31) tmp = x; elseif (a <= 2.7) tmp = Float64(x + Float64(a + tan(Float64(y + z)))); else tmp = Float64(x + sin(z)); 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.31)
tmp = x;
elseif (a <= 2.7)
tmp = x + (a + tan((y + z)));
else
tmp = x + sin(z);
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.31], x, If[LessEqual[a, 2.7], N[(x + N[(a + N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[z], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.31:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.7:\\
\;\;\;\;x + \left(a + \tan \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \sin z\\
\end{array}
\end{array}
if a < -0.309999999999999998Initial program 75.8%
Taylor expanded in x around inf 22.9%
if -0.309999999999999998 < a < 2.7000000000000002Initial program 80.0%
Taylor expanded in a around 0 79.4%
add-sqr-sqrt78.8%
fma-define78.9%
Applied egg-rr78.9%
fma-undefine78.8%
add-sqr-sqrt79.4%
sub-neg79.4%
add-sqr-sqrt36.7%
sqrt-unprod78.4%
sqr-neg78.4%
sqrt-unprod41.7%
add-sqr-sqrt78.1%
Applied egg-rr78.1%
if 2.7000000000000002 < a Initial program 78.4%
+-commutative78.4%
sub-neg78.4%
associate-+l+78.3%
tan-quot78.3%
div-inv78.3%
fma-define78.3%
neg-mul-178.3%
fma-define78.3%
Applied egg-rr78.3%
fma-undefine78.3%
fma-undefine78.3%
neg-mul-178.3%
associate-*r/78.3%
*-rgt-identity78.3%
+-commutative78.3%
+-commutative78.3%
+-commutative78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in z around 0 58.6%
Taylor expanded in y around 0 41.3%
associate--l+41.3%
Simplified41.3%
Taylor expanded in a around 0 21.9%
+-commutative21.9%
Simplified21.9%
Final simplification49.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.35) x (if (<= a 1.55) (+ x (- (tan y) a)) (+ x (sin z)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (a <= -1.35) {
tmp = x;
} else if (a <= 1.55) {
tmp = x + (tan(y) - a);
} else {
tmp = x + sin(z);
}
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.35d0)) then
tmp = x
else if (a <= 1.55d0) then
tmp = x + (tan(y) - a)
else
tmp = x + sin(z)
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.35) {
tmp = x;
} else if (a <= 1.55) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x + Math.sin(z);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if a <= -1.35: tmp = x elif a <= 1.55: tmp = x + (math.tan(y) - a) else: tmp = x + math.sin(z) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if (a <= -1.35) tmp = x; elseif (a <= 1.55) tmp = Float64(x + Float64(tan(y) - a)); else tmp = Float64(x + sin(z)); 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.35)
tmp = x;
elseif (a <= 1.55)
tmp = x + (tan(y) - a);
else
tmp = x + sin(z);
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.35], x, If[LessEqual[a, 1.55], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[z], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.55:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \sin z\\
\end{array}
\end{array}
if a < -1.3500000000000001Initial program 75.8%
Taylor expanded in x around inf 22.9%
if -1.3500000000000001 < a < 1.55000000000000004Initial program 80.0%
Taylor expanded in a around 0 79.4%
Taylor expanded in y around inf 60.2%
if 1.55000000000000004 < a Initial program 78.4%
+-commutative78.4%
sub-neg78.4%
associate-+l+78.3%
tan-quot78.3%
div-inv78.3%
fma-define78.3%
neg-mul-178.3%
fma-define78.3%
Applied egg-rr78.3%
fma-undefine78.3%
fma-undefine78.3%
neg-mul-178.3%
associate-*r/78.3%
*-rgt-identity78.3%
+-commutative78.3%
+-commutative78.3%
+-commutative78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in z around 0 58.6%
Taylor expanded in y around 0 41.3%
associate--l+41.3%
Simplified41.3%
Taylor expanded in a around 0 21.9%
+-commutative21.9%
Simplified21.9%
Final simplification40.5%
NOTE: x, y, z, and a should be sorted in increasing order before calling this function. (FPCore (x y z a) :precision binary64 (+ x (sin z)))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + sin(z);
}
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 + sin(z)
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
return x + Math.sin(z);
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + math.sin(z)
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x + sin(z)) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x + sin(z);
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[Sin[z], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \sin z
\end{array}
Initial program 78.6%
+-commutative78.6%
sub-neg78.6%
associate-+l+78.5%
tan-quot78.5%
div-inv78.5%
fma-define78.5%
neg-mul-178.5%
fma-define78.5%
Applied egg-rr78.5%
fma-undefine78.5%
fma-undefine78.5%
neg-mul-178.5%
associate-*r/78.5%
*-rgt-identity78.5%
+-commutative78.5%
+-commutative78.5%
+-commutative78.5%
sub-neg78.5%
Simplified78.5%
Taylor expanded in z around 0 59.8%
Taylor expanded in y around 0 40.4%
associate--l+40.4%
Simplified40.4%
Taylor expanded in a around 0 30.9%
+-commutative30.9%
Simplified30.9%
Final simplification30.9%
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 78.6%
Taylor expanded in x around inf 30.5%
herbie shell --seed 2024116
(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))))