
(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 12 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 (- (/ (+ (/ (sin z) (cos z)) (tan y)) (- 1.0 (/ (sin z) (/ (cos z) (tan y))))) (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + ((((sin(z) / cos(z)) + tan(y)) / (1.0 - (sin(z) / (cos(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 + ((((sin(z) / cos(z)) + tan(y)) / (1.0d0 - (sin(z) / (cos(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.sin(z) / Math.cos(z)) + Math.tan(y)) / (1.0 - (Math.sin(z) / (Math.cos(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.sin(z) / math.cos(z)) + math.tan(y)) / (1.0 - (math.sin(z) / (math.cos(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(Float64(sin(z) / cos(z)) + tan(y)) / Float64(1.0 - Float64(sin(z) / Float64(cos(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 + ((((sin(z) / cos(z)) + tan(y)) / (1.0 - (sin(z) / (cos(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[(N[Sin[z], $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Sin[z], $MachinePrecision] / N[(N[Cos[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(\frac{\frac{\sin z}{\cos z} + \tan y}{1 - \frac{\sin z}{\frac{\cos z}{\tan y}}} - \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 (/ (sin z) (/ (cos 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(y) + tan(z)) / (1.0 - (sin(z) / (cos(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(y) + tan(z)) / (1.0d0 - (sin(z) / (cos(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(y) + Math.tan(z)) / (1.0 - (Math.sin(z) / (Math.cos(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(y) + math.tan(z)) / (1.0 - (math.sin(z) / (math.cos(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(y) + tan(z)) / Float64(1.0 - Float64(sin(z) / Float64(cos(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(y) + tan(z)) / (1.0 - (sin(z) / (cos(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[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Sin[z], $MachinePrecision] / N[(N[Cos[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(\frac{\tan y + \tan z}{1 - \frac{\sin z}{\frac{\cos z}{\tan y}}} - \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 a) (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x - (tan(a) - ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(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 - (tan(a) - ((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(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.tan(a) - ((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x - (math.tan(a) - ((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))))
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x - Float64(tan(a) - Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))))) end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp = code(x, y, z, a)
tmp = x - (tan(a) - ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(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[(N[Tan[a], $MachinePrecision] - 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]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x - \left(\tan a - \frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\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 (if (or (<= a -2.4e-8) (not (<= a 3.9e-7))) (+ x (/ 1.0 (/ 1.0 (- (tan (+ z y)) (tan a))))) (+ (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) (- x a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -2.4e-8) || !(a <= 3.9e-7)) {
tmp = x + (1.0 / (1.0 / (tan((z + y)) - tan(a))));
} else {
tmp = ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) + (x - 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 <= (-2.4d-8)) .or. (.not. (a <= 3.9d-7))) then
tmp = x + (1.0d0 / (1.0d0 / (tan((z + y)) - tan(a))))
else
tmp = ((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) + (x - 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 <= -2.4e-8) || !(a <= 3.9e-7)) {
tmp = x + (1.0 / (1.0 / (Math.tan((z + y)) - Math.tan(a))));
} else {
tmp = ((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) + (x - a);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if (a <= -2.4e-8) or not (a <= 3.9e-7): tmp = x + (1.0 / (1.0 / (math.tan((z + y)) - math.tan(a)))) else: tmp = ((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) + (x - a) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if ((a <= -2.4e-8) || !(a <= 3.9e-7)) tmp = Float64(x + Float64(1.0 / Float64(1.0 / Float64(tan(Float64(z + y)) - tan(a))))); else tmp = Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))) + Float64(x - 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 <= -2.4e-8) || ~((a <= 3.9e-7)))
tmp = x + (1.0 / (1.0 / (tan((z + y)) - tan(a))));
else
tmp = ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) + (x - 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, -2.4e-8], N[Not[LessEqual[a, 3.9e-7]], $MachinePrecision]], N[(x + N[(1.0 / N[(1.0 / N[(N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[(x - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-8} \lor \neg \left(a \leq 3.9 \cdot 10^{-7}\right):\\
\;\;\;\;x + \frac{1}{\frac{1}{\tan \left(z + y\right) - \tan a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} + \left(x - a\right)\\
\end{array}
\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 (if (<= (tan a) -2e-6) (/ 1.0 (/ 1.0 x)) (if (<= (tan a) 1e-7) (+ a (+ x (tan (+ z y)))) (+ x (- y (tan a))))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if (tan(a) <= -2e-6) {
tmp = 1.0 / (1.0 / x);
} else if (tan(a) <= 1e-7) {
tmp = a + (x + tan((z + y)));
} 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 (tan(a) <= (-2d-6)) then
tmp = 1.0d0 / (1.0d0 / x)
else if (tan(a) <= 1d-7) then
tmp = a + (x + tan((z + y)))
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 (Math.tan(a) <= -2e-6) {
tmp = 1.0 / (1.0 / x);
} else if (Math.tan(a) <= 1e-7) {
tmp = a + (x + Math.tan((z + y)));
} 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 math.tan(a) <= -2e-6: tmp = 1.0 / (1.0 / x) elif math.tan(a) <= 1e-7: tmp = a + (x + math.tan((z + y))) 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 (tan(a) <= -2e-6) tmp = Float64(1.0 / Float64(1.0 / x)); elseif (tan(a) <= 1e-7) tmp = Float64(a + Float64(x + tan(Float64(z + y)))); 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 (tan(a) <= -2e-6)
tmp = 1.0 / (1.0 / x);
elseif (tan(a) <= 1e-7)
tmp = a + (x + tan((z + y)));
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[N[Tan[a], $MachinePrecision], -2e-6], N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 1e-7], N[(a + N[(x + N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision]), $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}\;\tan a \leq -2 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\frac{1}{x}}\\
\mathbf{elif}\;\tan a \leq 10^{-7}:\\
\;\;\;\;a + \left(x + \tan \left(z + y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\end{array}
\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 (if (<= (tan a) -0.005) x (if (<= (tan a) 0.035) (+ (tan (+ z y)) (- x 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 (tan(a) <= -0.005) {
tmp = x;
} else if (tan(a) <= 0.035) {
tmp = tan((z + y)) + (x - 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 (tan(a) <= (-0.005d0)) then
tmp = x
else if (tan(a) <= 0.035d0) then
tmp = tan((z + y)) + (x - 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 (Math.tan(a) <= -0.005) {
tmp = x;
} else if (Math.tan(a) <= 0.035) {
tmp = Math.tan((z + y)) + (x - 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 math.tan(a) <= -0.005: tmp = x elif math.tan(a) <= 0.035: tmp = math.tan((z + y)) + (x - 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 (tan(a) <= -0.005) tmp = x; elseif (tan(a) <= 0.035) tmp = Float64(tan(Float64(z + y)) + Float64(x - 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 (tan(a) <= -0.005)
tmp = x;
elseif (tan(a) <= 0.035)
tmp = tan((z + y)) + (x - 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[N[Tan[a], $MachinePrecision], -0.005], x, If[LessEqual[N[Tan[a], $MachinePrecision], 0.035], N[(N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision] + N[(x - 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}\;\tan a \leq -0.005:\\
\;\;\;\;x\\
\mathbf{elif}\;\tan a \leq 0.035:\\
\;\;\;\;\tan \left(z + y\right) + \left(x - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\end{array}
\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 (if (<= (tan a) -0.005) (exp (log x)) (if (<= (tan a) 0.035) (+ (tan (+ z y)) (- x 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 (tan(a) <= -0.005) {
tmp = exp(log(x));
} else if (tan(a) <= 0.035) {
tmp = tan((z + y)) + (x - 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 (tan(a) <= (-0.005d0)) then
tmp = exp(log(x))
else if (tan(a) <= 0.035d0) then
tmp = tan((z + y)) + (x - 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 (Math.tan(a) <= -0.005) {
tmp = Math.exp(Math.log(x));
} else if (Math.tan(a) <= 0.035) {
tmp = Math.tan((z + y)) + (x - 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 math.tan(a) <= -0.005: tmp = math.exp(math.log(x)) elif math.tan(a) <= 0.035: tmp = math.tan((z + y)) + (x - 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 (tan(a) <= -0.005) tmp = exp(log(x)); elseif (tan(a) <= 0.035) tmp = Float64(tan(Float64(z + y)) + Float64(x - 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 (tan(a) <= -0.005)
tmp = exp(log(x));
elseif (tan(a) <= 0.035)
tmp = tan((z + y)) + (x - 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[N[Tan[a], $MachinePrecision], -0.005], N[Exp[N[Log[x], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 0.035], N[(N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision] + N[(x - 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}\;\tan a \leq -0.005:\\
\;\;\;\;e^{\log x}\\
\mathbf{elif}\;\tan a \leq 0.035:\\
\;\;\;\;\tan \left(z + y\right) + \left(x - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\end{array}
\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 (if (or (<= a -2.4e-8) (not (<= a 14.4))) (+ x (- (tan y) (tan a))) (+ (tan (+ z y)) (- x a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -2.4e-8) || !(a <= 14.4)) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = tan((z + y)) + (x - 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 <= (-2.4d-8)) .or. (.not. (a <= 14.4d0))) then
tmp = x + (tan(y) - tan(a))
else
tmp = tan((z + y)) + (x - 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 <= -2.4e-8) || !(a <= 14.4)) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = Math.tan((z + y)) + (x - a);
}
return tmp;
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): tmp = 0 if (a <= -2.4e-8) or not (a <= 14.4): tmp = x + (math.tan(y) - math.tan(a)) else: tmp = math.tan((z + y)) + (x - a) return tmp
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) tmp = 0.0 if ((a <= -2.4e-8) || !(a <= 14.4)) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(tan(Float64(z + y)) + Float64(x - 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 <= -2.4e-8) || ~((a <= 14.4)))
tmp = x + (tan(y) - tan(a));
else
tmp = tan((z + y)) + (x - 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, -2.4e-8], N[Not[LessEqual[a, 14.4]], $MachinePrecision]], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision] + N[(x - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-8} \lor \neg \left(a \leq 14.4\right):\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;\tan \left(z + y\right) + \left(x - a\right)\\
\end{array}
\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 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 + 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 + 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 + 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 + y)) - math.tan(a))))
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x + Float64(1.0 / Float64(1.0 / Float64(tan(Float64(z + 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 + 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[(1.0 / N[(1.0 / N[(N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \frac{1}{\frac{1}{\tan \left(z + y\right) - \tan a}}
\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 (+ z y)) (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
return x + (tan((z + 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 + 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 + y)) - Math.tan(a));
}
[x, y, z, a] = sort([x, y, z, a]) def code(x, y, z, a): return x + (math.tan((z + y)) - math.tan(a))
x, y, z, a = sort([x, y, z, a]) function code(x, y, z, a) return Float64(x + Float64(tan(Float64(z + 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 + 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[Tan[N[(z + y), $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(z + y\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 (if (<= y -1.8) 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.8) {
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.8d0)) 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.8) {
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.8: 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.8) 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.8)
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.8], 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.8:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\end{array}
\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)
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}
herbie shell --seed 2024006
(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))))