
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cosh x) (/ y x))))
(if (or (<= t_0 -5e+285) (not (<= t_0 1e+249)))
(* y (/ (/ (cosh x) x) z))
(/ t_0 z))))
double code(double x, double y, double z) {
double t_0 = cosh(x) * (y / x);
double tmp;
if ((t_0 <= -5e+285) || !(t_0 <= 1e+249)) {
tmp = y * ((cosh(x) / x) / z);
} else {
tmp = t_0 / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = cosh(x) * (y / x)
if ((t_0 <= (-5d+285)) .or. (.not. (t_0 <= 1d+249))) then
tmp = y * ((cosh(x) / x) / z)
else
tmp = t_0 / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(x) * (y / x);
double tmp;
if ((t_0 <= -5e+285) || !(t_0 <= 1e+249)) {
tmp = y * ((Math.cosh(x) / x) / z);
} else {
tmp = t_0 / z;
}
return tmp;
}
def code(x, y, z): t_0 = math.cosh(x) * (y / x) tmp = 0 if (t_0 <= -5e+285) or not (t_0 <= 1e+249): tmp = y * ((math.cosh(x) / x) / z) else: tmp = t_0 / z return tmp
function code(x, y, z) t_0 = Float64(cosh(x) * Float64(y / x)) tmp = 0.0 if ((t_0 <= -5e+285) || !(t_0 <= 1e+249)) tmp = Float64(y * Float64(Float64(cosh(x) / x) / z)); else tmp = Float64(t_0 / z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = cosh(x) * (y / x); tmp = 0.0; if ((t_0 <= -5e+285) || ~((t_0 <= 1e+249))) tmp = y * ((cosh(x) / x) / z); else tmp = t_0 / z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e+285], N[Not[LessEqual[t$95$0, 1e+249]], $MachinePrecision]], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+285} \lor \neg \left(t_0 \leq 10^{+249}\right):\\
\;\;\;\;y \cdot \frac{\frac{\cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{z}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < -5.00000000000000016e285 or 9.9999999999999992e248 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 69.3%
associate-*l/69.3%
Simplified69.3%
associate-/r/62.3%
associate-/l*72.7%
*-commutative72.7%
expm1-log1p-u41.5%
expm1-udef41.5%
associate-/l*46.1%
times-frac49.0%
Applied egg-rr49.0%
expm1-def49.0%
expm1-log1p90.1%
associate-*r/91.2%
*-commutative91.2%
associate-*r/99.9%
Simplified99.9%
if -5.00000000000000016e285 < (*.f64 (cosh.f64 x) (/.f64 y x)) < 9.9999999999999992e248Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.2e-99) (not (<= z 3e-135))) (* y (/ (/ (cosh x) x) z)) (/ (cosh x) (* x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.2e-99) || !(z <= 3e-135)) {
tmp = y * ((cosh(x) / x) / z);
} else {
tmp = cosh(x) / (x * (z / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.2d-99)) .or. (.not. (z <= 3d-135))) then
tmp = y * ((cosh(x) / x) / z)
else
tmp = cosh(x) / (x * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.2e-99) || !(z <= 3e-135)) {
tmp = y * ((Math.cosh(x) / x) / z);
} else {
tmp = Math.cosh(x) / (x * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.2e-99) or not (z <= 3e-135): tmp = y * ((math.cosh(x) / x) / z) else: tmp = math.cosh(x) / (x * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.2e-99) || !(z <= 3e-135)) tmp = Float64(y * Float64(Float64(cosh(x) / x) / z)); else tmp = Float64(cosh(x) / Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.2e-99) || ~((z <= 3e-135))) tmp = y * ((cosh(x) / x) / z); else tmp = cosh(x) / (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.2e-99], N[Not[LessEqual[z, 3e-135]], $MachinePrecision]], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] / N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-99} \lor \neg \left(z \leq 3 \cdot 10^{-135}\right):\\
\;\;\;\;y \cdot \frac{\frac{\cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y}}\\
\end{array}
\end{array}
if z < -1.2e-99 or 3.00000000000000012e-135 < z Initial program 76.1%
associate-*l/76.0%
Simplified76.0%
associate-/r/68.8%
associate-/l*72.9%
*-commutative72.9%
expm1-log1p-u47.9%
expm1-udef35.2%
associate-/l*39.7%
times-frac42.9%
Applied egg-rr42.9%
expm1-def51.0%
expm1-log1p85.3%
associate-*r/91.5%
*-commutative91.5%
associate-*r/98.7%
Simplified98.7%
if -1.2e-99 < z < 3.00000000000000012e-135Initial program 86.6%
associate-/l*86.6%
associate-/r/98.6%
associate-*l/87.5%
*-commutative87.5%
Simplified87.5%
*-commutative87.5%
associate-/l*86.6%
associate-/r/98.6%
Applied egg-rr98.6%
Final simplification98.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (cosh x) x)))
(if (or (<= y -8.5e+86) (not (<= y 2000000000.0)))
(* y (/ t_0 z))
(/ (* y t_0) z))))
double code(double x, double y, double z) {
double t_0 = cosh(x) / x;
double tmp;
if ((y <= -8.5e+86) || !(y <= 2000000000.0)) {
tmp = y * (t_0 / z);
} else {
tmp = (y * t_0) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = cosh(x) / x
if ((y <= (-8.5d+86)) .or. (.not. (y <= 2000000000.0d0))) then
tmp = y * (t_0 / z)
else
tmp = (y * t_0) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(x) / x;
double tmp;
if ((y <= -8.5e+86) || !(y <= 2000000000.0)) {
tmp = y * (t_0 / z);
} else {
tmp = (y * t_0) / z;
}
return tmp;
}
def code(x, y, z): t_0 = math.cosh(x) / x tmp = 0 if (y <= -8.5e+86) or not (y <= 2000000000.0): tmp = y * (t_0 / z) else: tmp = (y * t_0) / z return tmp
function code(x, y, z) t_0 = Float64(cosh(x) / x) tmp = 0.0 if ((y <= -8.5e+86) || !(y <= 2000000000.0)) tmp = Float64(y * Float64(t_0 / z)); else tmp = Float64(Float64(y * t_0) / z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = cosh(x) / x; tmp = 0.0; if ((y <= -8.5e+86) || ~((y <= 2000000000.0))) tmp = y * (t_0 / z); else tmp = (y * t_0) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]}, If[Or[LessEqual[y, -8.5e+86], N[Not[LessEqual[y, 2000000000.0]], $MachinePrecision]], N[(y * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * t$95$0), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\cosh x}{x}\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+86} \lor \neg \left(y \leq 2000000000\right):\\
\;\;\;\;y \cdot \frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot t_0}{z}\\
\end{array}
\end{array}
if y < -8.5000000000000005e86 or 2e9 < y Initial program 85.8%
associate-*l/85.8%
Simplified85.8%
associate-/r/82.9%
associate-/l*91.4%
*-commutative91.4%
expm1-log1p-u57.4%
expm1-udef56.6%
associate-/l*56.6%
times-frac61.2%
Applied egg-rr61.2%
expm1-def62.1%
expm1-log1p99.8%
associate-*r/85.8%
*-commutative85.8%
associate-*r/99.9%
Simplified99.9%
if -8.5000000000000005e86 < y < 2e9Initial program 74.4%
expm1-log1p-u44.7%
expm1-udef30.7%
Applied egg-rr30.7%
expm1-def44.7%
expm1-log1p74.4%
associate-*r/99.9%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (* y (/ (/ (cosh x) x) z)))
double code(double x, double y, double z) {
return y * ((cosh(x) / x) / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y * ((cosh(x) / x) / z)
end function
public static double code(double x, double y, double z) {
return y * ((Math.cosh(x) / x) / z);
}
def code(x, y, z): return y * ((math.cosh(x) / x) / z)
function code(x, y, z) return Float64(y * Float64(Float64(cosh(x) / x) / z)) end
function tmp = code(x, y, z) tmp = y * ((cosh(x) / x) / z); end
code[x_, y_, z_] := N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{\frac{\cosh x}{x}}{z}
\end{array}
Initial program 79.2%
associate-*l/79.1%
Simplified79.1%
associate-/r/74.0%
associate-/l*77.2%
*-commutative77.2%
expm1-log1p-u48.6%
expm1-udef38.9%
associate-/l*42.0%
times-frac45.7%
Applied egg-rr45.7%
expm1-def52.2%
expm1-log1p89.6%
associate-*r/93.9%
*-commutative93.9%
associate-*r/95.4%
Simplified95.4%
Final simplification95.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -195000.0) (not (<= x 2.1e-38))) (* y (/ (+ z (* (* x 0.5) (* x z))) (* z (* x z)))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -195000.0) || !(x <= 2.1e-38)) {
tmp = y * ((z + ((x * 0.5) * (x * z))) / (z * (x * z)));
} else {
tmp = (y / z) / x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-195000.0d0)) .or. (.not. (x <= 2.1d-38))) then
tmp = y * ((z + ((x * 0.5d0) * (x * z))) / (z * (x * z)))
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -195000.0) || !(x <= 2.1e-38)) {
tmp = y * ((z + ((x * 0.5) * (x * z))) / (z * (x * z)));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -195000.0) or not (x <= 2.1e-38): tmp = y * ((z + ((x * 0.5) * (x * z))) / (z * (x * z))) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -195000.0) || !(x <= 2.1e-38)) tmp = Float64(y * Float64(Float64(z + Float64(Float64(x * 0.5) * Float64(x * z))) / Float64(z * Float64(x * z)))); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -195000.0) || ~((x <= 2.1e-38))) tmp = y * ((z + ((x * 0.5) * (x * z))) / (z * (x * z))); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -195000.0], N[Not[LessEqual[x, 2.1e-38]], $MachinePrecision]], N[(y * N[(N[(z + N[(N[(x * 0.5), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -195000 \lor \neg \left(x \leq 2.1 \cdot 10^{-38}\right):\\
\;\;\;\;y \cdot \frac{z + \left(x \cdot 0.5\right) \cdot \left(x \cdot z\right)}{z \cdot \left(x \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -195000 or 2.10000000000000013e-38 < x Initial program 67.6%
associate-*l/67.6%
Simplified67.6%
associate-/r/58.4%
associate-/l*61.7%
*-commutative61.7%
expm1-log1p-u34.2%
expm1-udef31.0%
associate-/l*37.6%
times-frac41.8%
Applied egg-rr41.8%
expm1-def45.0%
expm1-log1p86.7%
associate-*r/99.2%
*-commutative99.2%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 43.8%
associate-*r/43.8%
frac-add49.1%
*-commutative49.1%
*-un-lft-identity49.1%
Applied egg-rr49.1%
if -195000 < x < 2.10000000000000013e-38Initial program 89.4%
associate-*l/89.3%
Simplified89.3%
Taylor expanded in x around 0 88.9%
*-un-lft-identity88.9%
times-frac90.0%
Applied egg-rr90.0%
associate-*l/90.2%
*-un-lft-identity90.2%
Applied egg-rr90.2%
Final simplification70.9%
(FPCore (x y z) :precision binary64 (* y (+ (* 0.5 (/ x z)) (/ 1.0 (* x z)))))
double code(double x, double y, double z) {
return y * ((0.5 * (x / z)) + (1.0 / (x * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y * ((0.5d0 * (x / z)) + (1.0d0 / (x * z)))
end function
public static double code(double x, double y, double z) {
return y * ((0.5 * (x / z)) + (1.0 / (x * z)));
}
def code(x, y, z): return y * ((0.5 * (x / z)) + (1.0 / (x * z)))
function code(x, y, z) return Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(1.0 / Float64(x * z)))) end
function tmp = code(x, y, z) tmp = y * ((0.5 * (x / z)) + (1.0 / (x * z))); end
code[x_, y_, z_] := N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{1}{x \cdot z}\right)
\end{array}
Initial program 79.2%
associate-*l/79.1%
Simplified79.1%
associate-/r/74.0%
associate-/l*77.2%
*-commutative77.2%
expm1-log1p-u48.6%
expm1-udef38.9%
associate-/l*42.0%
times-frac45.7%
Applied egg-rr45.7%
expm1-def52.2%
expm1-log1p89.6%
associate-*r/93.9%
*-commutative93.9%
associate-*r/95.4%
Simplified95.4%
Taylor expanded in x around 0 67.2%
Final simplification67.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -350.0) (not (<= x 1.45))) (* 0.5 (/ x (/ z y))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -350.0) || !(x <= 1.45)) {
tmp = 0.5 * (x / (z / y));
} else {
tmp = (y / z) / x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-350.0d0)) .or. (.not. (x <= 1.45d0))) then
tmp = 0.5d0 * (x / (z / y))
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -350.0) || !(x <= 1.45)) {
tmp = 0.5 * (x / (z / y));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -350.0) or not (x <= 1.45): tmp = 0.5 * (x / (z / y)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -350.0) || !(x <= 1.45)) tmp = Float64(0.5 * Float64(x / Float64(z / y))); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -350.0) || ~((x <= 1.45))) tmp = 0.5 * (x / (z / y)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -350.0], N[Not[LessEqual[x, 1.45]], $MachinePrecision]], N[(0.5 * N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -350 \lor \neg \left(x \leq 1.45\right):\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -350 or 1.44999999999999996 < x Initial program 68.1%
Taylor expanded in x around 0 36.2%
Taylor expanded in x around inf 36.2%
associate-/l*29.8%
Simplified29.8%
if -350 < x < 1.44999999999999996Initial program 88.8%
associate-*l/88.7%
Simplified88.7%
Taylor expanded in x around 0 91.8%
*-un-lft-identity91.8%
times-frac92.9%
Applied egg-rr92.9%
associate-*l/93.0%
*-un-lft-identity93.0%
Applied egg-rr93.0%
Final simplification63.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -350.0) (not (<= x 1.42))) (* x (* y (/ 0.5 z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -350.0) || !(x <= 1.42)) {
tmp = x * (y * (0.5 / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-350.0d0)) .or. (.not. (x <= 1.42d0))) then
tmp = x * (y * (0.5d0 / z))
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -350.0) || !(x <= 1.42)) {
tmp = x * (y * (0.5 / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -350.0) or not (x <= 1.42): tmp = x * (y * (0.5 / z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -350.0) || !(x <= 1.42)) tmp = Float64(x * Float64(y * Float64(0.5 / z))); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -350.0) || ~((x <= 1.42))) tmp = x * (y * (0.5 / z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -350.0], N[Not[LessEqual[x, 1.42]], $MachinePrecision]], N[(x * N[(y * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -350 \lor \neg \left(x \leq 1.42\right):\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -350 or 1.4199999999999999 < x Initial program 68.1%
associate-*l/68.1%
Simplified68.1%
associate-/r/58.0%
associate-/l*60.5%
*-commutative60.5%
expm1-log1p-u31.9%
expm1-udef31.9%
associate-/l*38.7%
times-frac42.9%
Applied egg-rr42.9%
expm1-def42.9%
expm1-log1p85.7%
associate-*r/100.0%
*-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 40.1%
Taylor expanded in x around inf 36.2%
associate-*r/36.2%
*-commutative36.2%
associate-*r/36.2%
associate-*l*29.8%
Simplified29.8%
if -350 < x < 1.4199999999999999Initial program 88.8%
associate-*l/88.7%
Simplified88.7%
Taylor expanded in x around 0 91.8%
*-un-lft-identity91.8%
times-frac92.9%
Applied egg-rr92.9%
associate-*l/93.0%
*-un-lft-identity93.0%
Applied egg-rr93.0%
Final simplification63.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -350.0) (not (<= x 1.42))) (* y (* x (/ 0.5 z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -350.0) || !(x <= 1.42)) {
tmp = y * (x * (0.5 / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-350.0d0)) .or. (.not. (x <= 1.42d0))) then
tmp = y * (x * (0.5d0 / z))
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -350.0) || !(x <= 1.42)) {
tmp = y * (x * (0.5 / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -350.0) or not (x <= 1.42): tmp = y * (x * (0.5 / z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -350.0) || !(x <= 1.42)) tmp = Float64(y * Float64(x * Float64(0.5 / z))); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -350.0) || ~((x <= 1.42))) tmp = y * (x * (0.5 / z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -350.0], N[Not[LessEqual[x, 1.42]], $MachinePrecision]], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -350 \lor \neg \left(x \leq 1.42\right):\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -350 or 1.4199999999999999 < x Initial program 68.1%
Taylor expanded in x around 0 36.2%
Taylor expanded in x around inf 36.2%
*-commutative36.2%
*-commutative36.2%
associate-*r*36.2%
*-commutative36.2%
Simplified36.2%
*-commutative36.2%
associate-*l/40.1%
*-commutative40.1%
*-un-lft-identity40.1%
times-frac40.1%
/-rgt-identity40.1%
Applied egg-rr40.1%
if -350 < x < 1.4199999999999999Initial program 88.8%
associate-*l/88.7%
Simplified88.7%
Taylor expanded in x around 0 91.8%
*-un-lft-identity91.8%
times-frac92.9%
Applied egg-rr92.9%
associate-*l/93.0%
*-un-lft-identity93.0%
Applied egg-rr93.0%
Final simplification68.4%
(FPCore (x y z) :precision binary64 (if (<= x -350.0) (* x (* 0.5 (/ y z))) (if (<= x 1.42) (/ (/ y z) x) (* x (* y (/ 0.5 z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -350.0) {
tmp = x * (0.5 * (y / z));
} else if (x <= 1.42) {
tmp = (y / z) / x;
} else {
tmp = x * (y * (0.5 / z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-350.0d0)) then
tmp = x * (0.5d0 * (y / z))
else if (x <= 1.42d0) then
tmp = (y / z) / x
else
tmp = x * (y * (0.5d0 / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -350.0) {
tmp = x * (0.5 * (y / z));
} else if (x <= 1.42) {
tmp = (y / z) / x;
} else {
tmp = x * (y * (0.5 / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -350.0: tmp = x * (0.5 * (y / z)) elif x <= 1.42: tmp = (y / z) / x else: tmp = x * (y * (0.5 / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -350.0) tmp = Float64(x * Float64(0.5 * Float64(y / z))); elseif (x <= 1.42) tmp = Float64(Float64(y / z) / x); else tmp = Float64(x * Float64(y * Float64(0.5 / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -350.0) tmp = x * (0.5 * (y / z)); elseif (x <= 1.42) tmp = (y / z) / x; else tmp = x * (y * (0.5 / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -350.0], N[(x * N[(0.5 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.42], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(x * N[(y * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -350:\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{z}\right)\\
\mathbf{elif}\;x \leq 1.42:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{z}\right)\\
\end{array}
\end{array}
if x < -350Initial program 64.8%
Taylor expanded in x around 0 29.0%
Taylor expanded in x around inf 29.0%
associate-*r/29.0%
*-commutative29.0%
associate-/l*29.0%
Simplified29.0%
associate-/r*23.7%
associate-/r/23.7%
metadata-eval23.7%
associate-*l/23.7%
clear-num23.7%
*-commutative23.7%
Applied egg-rr23.7%
if -350 < x < 1.4199999999999999Initial program 88.8%
associate-*l/88.7%
Simplified88.7%
Taylor expanded in x around 0 91.8%
*-un-lft-identity91.8%
times-frac92.9%
Applied egg-rr92.9%
associate-*l/93.0%
*-un-lft-identity93.0%
Applied egg-rr93.0%
if 1.4199999999999999 < x Initial program 70.8%
associate-*l/70.8%
Simplified70.8%
associate-/r/60.0%
associate-/l*63.1%
*-commutative63.1%
expm1-log1p-u35.4%
expm1-udef35.4%
associate-/l*43.1%
times-frac46.2%
Applied egg-rr46.2%
expm1-def46.2%
expm1-log1p87.7%
associate-*r/100.0%
*-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 40.6%
Taylor expanded in x around inf 42.1%
associate-*r/42.1%
*-commutative42.1%
associate-*r/42.1%
associate-*l*34.8%
Simplified34.8%
Final simplification63.6%
(FPCore (x y z) :precision binary64 (if (<= x -350.0) (* y (* x (/ 0.5 z))) (if (<= x 1.42) (/ (/ y z) x) (/ 0.5 (/ z (* x y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -350.0) {
tmp = y * (x * (0.5 / z));
} else if (x <= 1.42) {
tmp = (y / z) / x;
} else {
tmp = 0.5 / (z / (x * y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-350.0d0)) then
tmp = y * (x * (0.5d0 / z))
else if (x <= 1.42d0) then
tmp = (y / z) / x
else
tmp = 0.5d0 / (z / (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -350.0) {
tmp = y * (x * (0.5 / z));
} else if (x <= 1.42) {
tmp = (y / z) / x;
} else {
tmp = 0.5 / (z / (x * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -350.0: tmp = y * (x * (0.5 / z)) elif x <= 1.42: tmp = (y / z) / x else: tmp = 0.5 / (z / (x * y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -350.0) tmp = Float64(y * Float64(x * Float64(0.5 / z))); elseif (x <= 1.42) tmp = Float64(Float64(y / z) / x); else tmp = Float64(0.5 / Float64(z / Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -350.0) tmp = y * (x * (0.5 / z)); elseif (x <= 1.42) tmp = (y / z) / x; else tmp = 0.5 / (z / (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -350.0], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.42], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(0.5 / N[(z / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -350:\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\mathbf{elif}\;x \leq 1.42:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{z}{x \cdot y}}\\
\end{array}
\end{array}
if x < -350Initial program 64.8%
Taylor expanded in x around 0 29.0%
Taylor expanded in x around inf 29.0%
*-commutative29.0%
*-commutative29.0%
associate-*r*29.0%
*-commutative29.0%
Simplified29.0%
*-commutative29.0%
associate-*l/39.4%
*-commutative39.4%
*-un-lft-identity39.4%
times-frac39.4%
/-rgt-identity39.4%
Applied egg-rr39.4%
if -350 < x < 1.4199999999999999Initial program 88.8%
associate-*l/88.7%
Simplified88.7%
Taylor expanded in x around 0 91.8%
*-un-lft-identity91.8%
times-frac92.9%
Applied egg-rr92.9%
associate-*l/93.0%
*-un-lft-identity93.0%
Applied egg-rr93.0%
if 1.4199999999999999 < x Initial program 70.8%
Taylor expanded in x around 0 42.1%
Taylor expanded in x around inf 42.1%
associate-*r/42.1%
*-commutative42.1%
associate-/l*42.1%
Simplified42.1%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1e+88) (not (<= y 5e+20))) (/ y (* x z)) (/ (/ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e+88) || !(y <= 5e+20)) {
tmp = y / (x * z);
} else {
tmp = (y / x) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1d+88)) .or. (.not. (y <= 5d+20))) then
tmp = y / (x * z)
else
tmp = (y / x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1e+88) || !(y <= 5e+20)) {
tmp = y / (x * z);
} else {
tmp = (y / x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1e+88) or not (y <= 5e+20): tmp = y / (x * z) else: tmp = (y / x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1e+88) || !(y <= 5e+20)) tmp = Float64(y / Float64(x * z)); else tmp = Float64(Float64(y / x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1e+88) || ~((y <= 5e+20))) tmp = y / (x * z); else tmp = (y / x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1e+88], N[Not[LessEqual[y, 5e+20]], $MachinePrecision]], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+88} \lor \neg \left(y \leq 5 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if y < -9.99999999999999959e87 or 5e20 < y Initial program 85.5%
associate-*l/85.5%
Simplified85.5%
Taylor expanded in x around 0 65.0%
if -9.99999999999999959e87 < y < 5e20Initial program 74.8%
Taylor expanded in x around 0 50.0%
Final simplification56.2%
(FPCore (x y z) :precision binary64 (if (<= z 1e-78) (/ (/ y z) x) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1e-78) {
tmp = (y / z) / x;
} else {
tmp = y / (x * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1d-78) then
tmp = (y / z) / x
else
tmp = y / (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1e-78) {
tmp = (y / z) / x;
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1e-78: tmp = (y / z) / x else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1e-78) tmp = Float64(Float64(y / z) / x); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1e-78) tmp = (y / z) / x; else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1e-78], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 10^{-78}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 9.99999999999999999e-79Initial program 81.4%
associate-*l/81.4%
Simplified81.4%
Taylor expanded in x around 0 50.1%
*-un-lft-identity50.1%
times-frac59.4%
Applied egg-rr59.4%
associate-*l/59.5%
*-un-lft-identity59.5%
Applied egg-rr59.5%
if 9.99999999999999999e-79 < z Initial program 74.2%
associate-*l/74.2%
Simplified74.2%
Taylor expanded in x around 0 57.0%
Final simplification58.7%
(FPCore (x y z) :precision binary64 (/ y (* x z)))
double code(double x, double y, double z) {
return y / (x * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y / (x * z)
end function
public static double code(double x, double y, double z) {
return y / (x * z);
}
def code(x, y, z): return y / (x * z)
function code(x, y, z) return Float64(y / Float64(x * z)) end
function tmp = code(x, y, z) tmp = y / (x * z); end
code[x_, y_, z_] := N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{x \cdot z}
\end{array}
Initial program 79.2%
associate-*l/79.1%
Simplified79.1%
Taylor expanded in x around 0 52.3%
Final simplification52.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (/ y z) x) (cosh x))))
(if (< y -4.618902267687042e-52)
t_0
(if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y / z) / x) * cosh(x)
if (y < (-4.618902267687042d-52)) then
tmp = t_0
else if (y < 1.038530535935153d-39) then
tmp = ((cosh(x) * y) / x) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * Math.cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((Math.cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) / x) * math.cosh(x) tmp = 0 if y < -4.618902267687042e-52: tmp = t_0 elif y < 1.038530535935153e-39: tmp = ((math.cosh(x) * y) / x) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x)) tmp = 0.0 if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) / x) * cosh(x); tmp = 0.0; if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = ((cosh(x) * y) / x) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2023318
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))