
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
(FPCore (x y z a) :precision binary64 (fma (+ (tan y) (tan z)) (/ 1.0 (+ 1.0 (+ 1.0 (- -1.0 (* (tan y) (tan z)))))) (- x (tan a))))
double code(double x, double y, double z, double a) {
return fma((tan(y) + tan(z)), (1.0 / (1.0 + (1.0 + (-1.0 - (tan(y) * tan(z)))))), (x - tan(a)));
}
function code(x, y, z, a) return fma(Float64(tan(y) + tan(z)), Float64(1.0 / Float64(1.0 + Float64(1.0 + Float64(-1.0 - Float64(tan(y) * tan(z)))))), Float64(x - tan(a))) end
code[x_, y_, z_, a_] := N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 + N[(1.0 + N[(-1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\tan y + \tan z, \frac{1}{1 + \left(1 + \left(-1 - \tan y \cdot \tan z\right)\right)}, x - \tan a\right)
\end{array}
(FPCore (x y z a) :precision binary64 (+ x (fma (+ (tan y) (tan z)) (/ 1.0 (+ 1.0 (+ 1.0 (- -1.0 (* (tan y) (tan z)))))) (- (tan a)))))
double code(double x, double y, double z, double a) {
return x + fma((tan(y) + tan(z)), (1.0 / (1.0 + (1.0 + (-1.0 - (tan(y) * tan(z)))))), -tan(a));
}
function code(x, y, z, a) return Float64(x + fma(Float64(tan(y) + tan(z)), Float64(1.0 / Float64(1.0 + Float64(1.0 + Float64(-1.0 - Float64(tan(y) * tan(z)))))), Float64(-tan(a)))) end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 + N[(1.0 + N[(-1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-N[Tan[a], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(\tan y + \tan z, \frac{1}{1 + \left(1 + \left(-1 - \tan y \cdot \tan z\right)\right)}, -\tan a\right)
\end{array}
(FPCore (x y z a)
:precision binary64
(let* ((t_0 (tan (+ y z))))
(if (<= (tan a) -0.002)
(+ (- x (tan a)) t_0)
(if (<= (tan a) 2e-10)
(+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) a))
(+ x (+ t_0 (/ -1.0 (/ (cos a) (sin a)))))))))
double code(double x, double y, double z, double a) {
double t_0 = tan((y + z));
double tmp;
if (tan(a) <= -0.002) {
tmp = (x - tan(a)) + t_0;
} else if (tan(a) <= 2e-10) {
tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - a);
} else {
tmp = x + (t_0 + (-1.0 / (cos(a) / sin(a))));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: t_0
real(8) :: tmp
t_0 = tan((y + z))
if (tan(a) <= (-0.002d0)) then
tmp = (x - tan(a)) + t_0
else if (tan(a) <= 2d-10) then
tmp = x + (((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) - a)
else
tmp = x + (t_0 + ((-1.0d0) / (cos(a) / sin(a))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double t_0 = Math.tan((y + z));
double tmp;
if (Math.tan(a) <= -0.002) {
tmp = (x - Math.tan(a)) + t_0;
} else if (Math.tan(a) <= 2e-10) {
tmp = x + (((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
} else {
tmp = x + (t_0 + (-1.0 / (Math.cos(a) / Math.sin(a))));
}
return tmp;
}
def code(x, y, z, a): t_0 = math.tan((y + z)) tmp = 0 if math.tan(a) <= -0.002: tmp = (x - math.tan(a)) + t_0 elif math.tan(a) <= 2e-10: tmp = x + (((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) - a) else: tmp = x + (t_0 + (-1.0 / (math.cos(a) / math.sin(a)))) return tmp
function code(x, y, z, a) t_0 = tan(Float64(y + z)) tmp = 0.0 if (tan(a) <= -0.002) tmp = Float64(Float64(x - tan(a)) + t_0); elseif (tan(a) <= 2e-10) tmp = Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))) - a)); else tmp = Float64(x + Float64(t_0 + Float64(-1.0 / Float64(cos(a) / sin(a))))); end return tmp end
function tmp_2 = code(x, y, z, a) t_0 = tan((y + z)); tmp = 0.0; if (tan(a) <= -0.002) tmp = (x - tan(a)) + t_0; elseif (tan(a) <= 2e-10) tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - a); else tmp = x + (t_0 + (-1.0 / (cos(a) / sin(a)))); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.002], N[(N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 2e-10], 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[(t$95$0 + N[(-1.0 / N[(N[Cos[a], $MachinePrecision] / N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan \left(y + z\right)\\
\mathbf{if}\;\tan a \leq -0.002:\\
\;\;\;\;\left(x - \tan a\right) + t_0\\
\mathbf{elif}\;\tan a \leq 2 \cdot 10^{-10}:\\
\;\;\;\;x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t_0 + \frac{-1}{\frac{\cos a}{\sin a}}\right)\\
\end{array}
\end{array}
(FPCore (x y z a) :precision binary64 (+ x (fma (+ (tan y) (tan z)) (/ 1.0 (- 1.0 (* (tan y) (tan z)))) (- (tan a)))))
double code(double x, double y, double z, double a) {
return x + fma((tan(y) + tan(z)), (1.0 / (1.0 - (tan(y) * tan(z)))), -tan(a));
}
function code(x, y, z, a) return Float64(x + fma(Float64(tan(y) + tan(z)), Float64(1.0 / Float64(1.0 - Float64(tan(y) * tan(z)))), Float64(-tan(a)))) end
code[x_, y_, z_, a_] := N[(x + 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] + (-N[Tan[a], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(\tan y + \tan z, \frac{1}{1 - \tan y \cdot \tan z}, -\tan a\right)
\end{array}
(FPCore (x y z a) :precision binary64 (fma (+ (tan y) (tan z)) (/ 1.0 (- 1.0 (* (tan y) (tan z)))) (- x (tan a))))
double code(double x, double y, double z, double a) {
return fma((tan(y) + tan(z)), (1.0 / (1.0 - (tan(y) * tan(z)))), (x - tan(a)));
}
function code(x, y, z, a) return fma(Float64(tan(y) + tan(z)), Float64(1.0 / Float64(1.0 - Float64(tan(y) * tan(z)))), Float64(x - tan(a))) end
code[x_, y_, z_, a_] := 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] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\tan y + \tan z, \frac{1}{1 - \tan y \cdot \tan z}, x - \tan a\right)
\end{array}
(FPCore (x y z a) :precision binary64 (+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) (tan a))))
double code(double x, double y, double z, double a) {
return x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) - Math.tan(a));
}
def code(x, y, z, a): return x + (((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)
\end{array}
(FPCore (x y z a) :precision binary64 (+ (- x (tan a)) (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z))))))
double code(double x, double y, double z, double a) {
return (x - tan(a)) + ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z))));
}
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
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))));
}
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))))
function code(x, y, z, a) return Float64(Float64(x - tan(a)) + Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z))))) end
function tmp = code(x, y, z, a) tmp = (x - tan(a)) + ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))); end
code[x_, y_, z_, a_] := N[(N[(x - N[Tan[a], $MachinePrecision]), $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]
\begin{array}{l}
\\
\left(x - \tan a\right) + \frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}
\end{array}
(FPCore (x y z a) :precision binary64 (if (or (<= (tan a) -0.002) (not (<= (tan a) 2e-10))) (+ x (- y (tan a))) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((tan(a) <= -0.002) || !(tan(a) <= 2e-10)) {
tmp = x + (y - tan(a));
} else {
tmp = x + (tan((y + z)) - a);
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((tan(a) <= (-0.002d0)) .or. (.not. (tan(a) <= 2d-10))) then
tmp = x + (y - tan(a))
else
tmp = x + (tan((y + z)) - a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((Math.tan(a) <= -0.002) || !(Math.tan(a) <= 2e-10)) {
tmp = x + (y - Math.tan(a));
} else {
tmp = x + (Math.tan((y + z)) - a);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (math.tan(a) <= -0.002) or not (math.tan(a) <= 2e-10): tmp = x + (y - math.tan(a)) else: tmp = x + (math.tan((y + z)) - a) return tmp
function code(x, y, z, a) tmp = 0.0 if ((tan(a) <= -0.002) || !(tan(a) <= 2e-10)) tmp = Float64(x + Float64(y - tan(a))); else tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((tan(a) <= -0.002) || ~((tan(a) <= 2e-10))) tmp = x + (y - tan(a)); else tmp = x + (tan((y + z)) - a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[Or[LessEqual[N[Tan[a], $MachinePrecision], -0.002], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 2e-10]], $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}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -0.002 \lor \neg \left(\tan a \leq 2 \cdot 10^{-10}\right):\\
\;\;\;\;x + \left(y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
(FPCore (x y z a) :precision binary64 (+ x (+ (tan (+ y z)) (/ -1.0 (/ (cos a) (sin a))))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) + (-1.0 / (cos(a) / sin(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)) + ((-1.0d0) / (cos(a) / sin(a))))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) + (-1.0 / (Math.cos(a) / Math.sin(a))));
}
def code(x, y, z, a): return x + (math.tan((y + z)) + (-1.0 / (math.cos(a) / math.sin(a))))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) + Float64(-1.0 / Float64(cos(a) / sin(a))))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) + (-1.0 / (cos(a) / sin(a)))); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] + N[(-1.0 / N[(N[Cos[a], $MachinePrecision] / N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) + \frac{-1}{\frac{\cos a}{\sin a}}\right)
\end{array}
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -500000000000.0) (+ x (/ (sin y) (cos y))) (if (<= (+ y z) 0.001) (+ x (- y (tan a))) (+ x (/ (sin z) (cos z))))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -500000000000.0) {
tmp = x + (sin(y) / cos(y));
} else if ((y + z) <= 0.001) {
tmp = x + (y - tan(a));
} else {
tmp = x + (sin(z) / cos(z));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((y + z) <= (-500000000000.0d0)) then
tmp = x + (sin(y) / cos(y))
else if ((y + z) <= 0.001d0) then
tmp = x + (y - tan(a))
else
tmp = x + (sin(z) / cos(z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -500000000000.0) {
tmp = x + (Math.sin(y) / Math.cos(y));
} else if ((y + z) <= 0.001) {
tmp = x + (y - Math.tan(a));
} else {
tmp = x + (Math.sin(z) / Math.cos(z));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= -500000000000.0: tmp = x + (math.sin(y) / math.cos(y)) elif (y + z) <= 0.001: tmp = x + (y - math.tan(a)) else: tmp = x + (math.sin(z) / math.cos(z)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= -500000000000.0) tmp = Float64(x + Float64(sin(y) / cos(y))); elseif (Float64(y + z) <= 0.001) tmp = Float64(x + Float64(y - tan(a))); else tmp = Float64(x + Float64(sin(z) / cos(z))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= -500000000000.0) tmp = x + (sin(y) / cos(y)); elseif ((y + z) <= 0.001) tmp = x + (y - tan(a)); else tmp = x + (sin(z) / cos(z)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -500000000000.0], N[(x + N[(N[Sin[y], $MachinePrecision] / N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y + z), $MachinePrecision], 0.001], N[(x + N[(y - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Sin[z], $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -500000000000:\\
\;\;\;\;x + \frac{\sin y}{\cos y}\\
\mathbf{elif}\;y + z \leq 0.001:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\sin z}{\cos z}\\
\end{array}
\end{array}
(FPCore (x y z a) :precision binary64 (if (or (<= a -2.15e-6) (not (<= a 1.7e-21))) (+ (- x (tan a)) (sin y)) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -2.15e-6) || !(a <= 1.7e-21)) {
tmp = (x - tan(a)) + sin(y);
} else {
tmp = x + (tan((y + z)) - a);
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-2.15d-6)) .or. (.not. (a <= 1.7d-21))) then
tmp = (x - tan(a)) + sin(y)
else
tmp = x + (tan((y + z)) - a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((a <= -2.15e-6) || !(a <= 1.7e-21)) {
tmp = (x - Math.tan(a)) + Math.sin(y);
} else {
tmp = x + (Math.tan((y + z)) - a);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (a <= -2.15e-6) or not (a <= 1.7e-21): tmp = (x - math.tan(a)) + math.sin(y) else: tmp = x + (math.tan((y + z)) - a) return tmp
function code(x, y, z, a) tmp = 0.0 if ((a <= -2.15e-6) || !(a <= 1.7e-21)) tmp = Float64(Float64(x - tan(a)) + sin(y)); else tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((a <= -2.15e-6) || ~((a <= 1.7e-21))) tmp = (x - tan(a)) + sin(y); else tmp = x + (tan((y + z)) - a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[Or[LessEqual[a, -2.15e-6], N[Not[LessEqual[a, 1.7e-21]], $MachinePrecision]], N[(N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.15 \cdot 10^{-6} \lor \neg \left(a \leq 1.7 \cdot 10^{-21}\right):\\
\;\;\;\;\left(x - \tan a\right) + \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) 0.001) (+ x (- (tan y) (tan a))) (+ x (/ (sin z) (cos z)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 0.001) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = x + (sin(z) / cos(z));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((y + z) <= 0.001d0) then
tmp = x + (tan(y) - tan(a))
else
tmp = x + (sin(z) / cos(z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 0.001) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = x + (Math.sin(z) / Math.cos(z));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= 0.001: tmp = x + (math.tan(y) - math.tan(a)) else: tmp = x + (math.sin(z) / math.cos(z)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= 0.001) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(x + Float64(sin(z) / cos(z))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= 0.001) tmp = x + (tan(y) - tan(a)); else tmp = x + (sin(z) / cos(z)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], 0.001], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Sin[z], $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq 0.001:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\sin z}{\cos z}\\
\end{array}
\end{array}
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) 0.001) (- (+ (tan y) x) (tan a)) (+ x (/ (sin z) (cos z)))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 0.001) {
tmp = (tan(y) + x) - tan(a);
} else {
tmp = x + (sin(z) / cos(z));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((y + z) <= 0.001d0) then
tmp = (tan(y) + x) - tan(a)
else
tmp = x + (sin(z) / cos(z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= 0.001) {
tmp = (Math.tan(y) + x) - Math.tan(a);
} else {
tmp = x + (Math.sin(z) / Math.cos(z));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= 0.001: tmp = (math.tan(y) + x) - math.tan(a) else: tmp = x + (math.sin(z) / math.cos(z)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= 0.001) tmp = Float64(Float64(tan(y) + x) - tan(a)); else tmp = Float64(x + Float64(sin(z) / cos(z))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= 0.001) tmp = (tan(y) + x) - tan(a); else tmp = x + (sin(z) / cos(z)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], 0.001], N[(N[(N[Tan[y], $MachinePrecision] + x), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Sin[z], $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq 0.001:\\
\;\;\;\;\left(\tan y + x\right) - \tan a\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\sin z}{\cos z}\\
\end{array}
\end{array}
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
(FPCore (x y z a) :precision binary64 (+ (- x (tan a)) (tan (+ y z))))
double code(double x, double y, double z, double a) {
return (x - tan(a)) + tan((y + z));
}
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 + z))
end function
public static double code(double x, double y, double z, double a) {
return (x - Math.tan(a)) + Math.tan((y + z));
}
def code(x, y, z, a): return (x - math.tan(a)) + math.tan((y + z))
function code(x, y, z, a) return Float64(Float64(x - tan(a)) + tan(Float64(y + z))) end
function tmp = code(x, y, z, a) tmp = (x - tan(a)) + tan((y + z)); end
code[x_, y_, z_, a_] := N[(N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision] + N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \tan a\right) + \tan \left(y + z\right)
\end{array}
(FPCore (x y z a) :precision binary64 (if (<= y -1.35) x (+ x (- y (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if (y <= -1.35) {
tmp = x;
} else {
tmp = x + (y - tan(a));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1.35d0)) then
tmp = x
else
tmp = x + (y - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (y <= -1.35) {
tmp = x;
} else {
tmp = x + (y - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if y <= -1.35: tmp = x else: tmp = x + (y - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (y <= -1.35) tmp = x; else tmp = Float64(x + Float64(y - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (y <= -1.35) tmp = x; else tmp = x + (y - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[y, -1.35], x, N[(x + N[(y - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \tan a\right)\\
\end{array}
\end{array}
(FPCore (x y z a) :precision binary64 x)
double code(double x, double y, double z, double a) {
return x;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double a) {
return x;
}
def code(x, y, z, a): return x
function code(x, y, z, a) return x end
function tmp = code(x, y, z, a) tmp = x; end
code[x_, y_, z_, a_] := x
\begin{array}{l}
\\
x
\end{array}
herbie shell --seed 2024008
(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))))