
(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 18 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 (if (<= y 2.7e+113) (/ (* y (/ (cosh x) x)) z) (/ (cosh x) (* x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.7e+113) {
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 (y <= 2.7d+113) 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 (y <= 2.7e+113) {
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 y <= 2.7e+113: 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 (y <= 2.7e+113) tmp = Float64(Float64(y * 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 (y <= 2.7e+113) tmp = (y * (cosh(x) / x)) / z; else tmp = cosh(x) / (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.7e+113], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] / N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.7 \cdot 10^{+113}:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y}}\\
\end{array}
\end{array}
if y < 2.70000000000000011e113Initial program 85.1%
expm1-log1p-u50.0%
expm1-udef38.8%
Applied egg-rr38.8%
expm1-def50.0%
expm1-log1p85.1%
associate-*r/97.6%
associate-*l/97.5%
*-commutative97.5%
Simplified97.5%
if 2.70000000000000011e113 < y Initial program 88.0%
associate-/l*88.0%
associate-/r/99.8%
associate-*l/95.6%
*-commutative95.6%
Simplified95.6%
*-commutative95.6%
associate-/l*88.0%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= y 2.2e+108) (* (/ (cosh x) z) (/ y x)) (/ (cosh x) (* x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.2e+108) {
tmp = (cosh(x) / z) * (y / x);
} 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 (y <= 2.2d+108) then
tmp = (cosh(x) / z) * (y / x)
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 (y <= 2.2e+108) {
tmp = (Math.cosh(x) / z) * (y / x);
} else {
tmp = Math.cosh(x) / (x * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.2e+108: tmp = (math.cosh(x) / z) * (y / x) else: tmp = math.cosh(x) / (x * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.2e+108) tmp = Float64(Float64(cosh(x) / z) * Float64(y / x)); 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 (y <= 2.2e+108) tmp = (cosh(x) / z) * (y / x); else tmp = cosh(x) / (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.2e+108], N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] / N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{+108}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y}}\\
\end{array}
\end{array}
if y < 2.2000000000000001e108Initial program 85.1%
associate-*l/85.1%
Simplified85.1%
if 2.2000000000000001e108 < y Initial program 88.0%
associate-/l*88.0%
associate-/r/99.8%
associate-*l/95.6%
*-commutative95.6%
Simplified95.6%
*-commutative95.6%
associate-/l*88.0%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification87.8%
(FPCore (x y z) :precision binary64 (* (/ (cosh x) z) (/ y x)))
double code(double x, double y, double z) {
return (cosh(x) / z) * (y / x);
}
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) / z) * (y / x)
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) / z) * (y / x);
}
def code(x, y, z): return (math.cosh(x) / z) * (y / x)
function code(x, y, z) return Float64(Float64(cosh(x) / z) * Float64(y / x)) end
function tmp = code(x, y, z) tmp = (cosh(x) / z) * (y / x); end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x}{z} \cdot \frac{y}{x}
\end{array}
Initial program 85.7%
associate-*l/85.6%
Simplified85.6%
Final simplification85.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -560.0) (not (<= x 380.0))) (* (/ (* y (+ z (* x (* 0.5 (* x z))))) z) (/ 1.0 (* x z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -560.0) || !(x <= 380.0)) {
tmp = ((y * (z + (x * (0.5 * (x * z))))) / z) * (1.0 / (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 <= (-560.0d0)) .or. (.not. (x <= 380.0d0))) then
tmp = ((y * (z + (x * (0.5d0 * (x * z))))) / z) * (1.0d0 / (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 <= -560.0) || !(x <= 380.0)) {
tmp = ((y * (z + (x * (0.5 * (x * z))))) / z) * (1.0 / (x * z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -560.0) or not (x <= 380.0): tmp = ((y * (z + (x * (0.5 * (x * z))))) / z) * (1.0 / (x * z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -560.0) || !(x <= 380.0)) tmp = Float64(Float64(Float64(y * Float64(z + Float64(x * Float64(0.5 * Float64(x * z))))) / z) * Float64(1.0 / 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 <= -560.0) || ~((x <= 380.0))) tmp = ((y * (z + (x * (0.5 * (x * z))))) / z) * (1.0 / (x * z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -560.0], N[Not[LessEqual[x, 380.0]], $MachinePrecision]], N[(N[(N[(y * N[(z + N[(x * N[(0.5 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * N[(1.0 / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -560 \lor \neg \left(x \leq 380\right):\\
\;\;\;\;\frac{y \cdot \left(z + x \cdot \left(0.5 \cdot \left(x \cdot z\right)\right)\right)}{z} \cdot \frac{1}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -560 or 380 < x Initial program 79.4%
associate-*l/79.4%
Simplified79.4%
Taylor expanded in x around 0 42.5%
associate-*r/42.5%
frac-add39.9%
*-commutative39.9%
*-commutative39.9%
associate-*l*39.9%
Applied egg-rr39.9%
associate-/r*47.0%
div-inv47.0%
associate-*l*55.5%
*-commutative55.5%
distribute-lft-out55.5%
associate-*l*55.5%
Applied egg-rr55.5%
if -560 < x < 380Initial program 91.8%
associate-*l/91.7%
Simplified91.7%
Taylor expanded in x around 0 89.7%
*-un-lft-identity89.7%
times-frac92.8%
Applied egg-rr92.8%
associate-*l/92.8%
*-un-lft-identity92.8%
Applied egg-rr92.8%
Final simplification74.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (* y x))))
(if (<= x -2.7e-7)
(/ (+ (* (/ y x) t_0) (* z 0.5)) (* z t_0))
(if (<= x 370.0)
(/ (/ y z) x)
(* (/ (* y (+ z (* x (* 0.5 (* x z))))) z) (/ 1.0 (* x z)))))))
double code(double x, double y, double z) {
double t_0 = z / (y * x);
double tmp;
if (x <= -2.7e-7) {
tmp = (((y / x) * t_0) + (z * 0.5)) / (z * t_0);
} else if (x <= 370.0) {
tmp = (y / z) / x;
} else {
tmp = ((y * (z + (x * (0.5 * (x * z))))) / z) * (1.0 / (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) :: t_0
real(8) :: tmp
t_0 = z / (y * x)
if (x <= (-2.7d-7)) then
tmp = (((y / x) * t_0) + (z * 0.5d0)) / (z * t_0)
else if (x <= 370.0d0) then
tmp = (y / z) / x
else
tmp = ((y * (z + (x * (0.5d0 * (x * z))))) / z) * (1.0d0 / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z / (y * x);
double tmp;
if (x <= -2.7e-7) {
tmp = (((y / x) * t_0) + (z * 0.5)) / (z * t_0);
} else if (x <= 370.0) {
tmp = (y / z) / x;
} else {
tmp = ((y * (z + (x * (0.5 * (x * z))))) / z) * (1.0 / (x * z));
}
return tmp;
}
def code(x, y, z): t_0 = z / (y * x) tmp = 0 if x <= -2.7e-7: tmp = (((y / x) * t_0) + (z * 0.5)) / (z * t_0) elif x <= 370.0: tmp = (y / z) / x else: tmp = ((y * (z + (x * (0.5 * (x * z))))) / z) * (1.0 / (x * z)) return tmp
function code(x, y, z) t_0 = Float64(z / Float64(y * x)) tmp = 0.0 if (x <= -2.7e-7) tmp = Float64(Float64(Float64(Float64(y / x) * t_0) + Float64(z * 0.5)) / Float64(z * t_0)); elseif (x <= 370.0) tmp = Float64(Float64(y / z) / x); else tmp = Float64(Float64(Float64(y * Float64(z + Float64(x * Float64(0.5 * Float64(x * z))))) / z) * Float64(1.0 / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z / (y * x); tmp = 0.0; if (x <= -2.7e-7) tmp = (((y / x) * t_0) + (z * 0.5)) / (z * t_0); elseif (x <= 370.0) tmp = (y / z) / x; else tmp = ((y * (z + (x * (0.5 * (x * z))))) / z) * (1.0 / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-7], N[(N[(N[(N[(y / x), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(z * 0.5), $MachinePrecision]), $MachinePrecision] / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 370.0], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(y * N[(z + N[(x * N[(0.5 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * N[(1.0 / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y \cdot x}\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{y}{x} \cdot t_0 + z \cdot 0.5}{z \cdot t_0}\\
\mathbf{elif}\;x \leq 370:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z + x \cdot \left(0.5 \cdot \left(x \cdot z\right)\right)\right)}{z} \cdot \frac{1}{x \cdot z}\\
\end{array}
\end{array}
if x < -2.70000000000000009e-7Initial program 79.7%
associate-*l/79.7%
Simplified79.7%
Taylor expanded in x around 0 47.1%
associate-*r/47.1%
clear-num47.1%
*-commutative47.1%
*-commutative47.1%
associate-*l*47.1%
Applied egg-rr47.1%
+-commutative47.1%
associate-/r*47.1%
associate-*r*47.1%
*-commutative47.1%
clear-num47.1%
associate-/l*47.1%
frac-add54.4%
Applied egg-rr54.4%
if -2.70000000000000009e-7 < x < 370Initial program 91.7%
associate-*l/91.6%
Simplified91.6%
Taylor expanded in x around 0 89.7%
*-un-lft-identity89.7%
times-frac92.7%
Applied egg-rr92.7%
associate-*l/92.8%
*-un-lft-identity92.8%
Applied egg-rr92.8%
if 370 < x Initial program 79.7%
associate-*l/79.7%
Simplified79.7%
Taylor expanded in x around 0 39.8%
associate-*r/39.8%
frac-add41.7%
*-commutative41.7%
*-commutative41.7%
associate-*l*41.7%
Applied egg-rr41.7%
associate-/r*49.4%
div-inv49.4%
associate-*l*58.5%
*-commutative58.5%
distribute-lft-out58.5%
associate-*l*58.5%
Applied egg-rr58.5%
Final simplification74.6%
(FPCore (x y z)
:precision binary64
(if (<= z 2.85e-74)
(/ (+ (/ y x) (* (* y x) 0.5)) z)
(if (<= z 2.9e+62)
(/ (* y (+ z (* x (* 0.5 (* x z))))) (* z (* x z)))
(+ (* 0.5 (/ (* y x) z)) (/ y (* x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.85e-74) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else if (z <= 2.9e+62) {
tmp = (y * (z + (x * (0.5 * (x * z))))) / (z * (x * z));
} else {
tmp = (0.5 * ((y * x) / z)) + (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 <= 2.85d-74) then
tmp = ((y / x) + ((y * x) * 0.5d0)) / z
else if (z <= 2.9d+62) then
tmp = (y * (z + (x * (0.5d0 * (x * z))))) / (z * (x * z))
else
tmp = (0.5d0 * ((y * x) / z)) + (y / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2.85e-74) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else if (z <= 2.9e+62) {
tmp = (y * (z + (x * (0.5 * (x * z))))) / (z * (x * z));
} else {
tmp = (0.5 * ((y * x) / z)) + (y / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.85e-74: tmp = ((y / x) + ((y * x) * 0.5)) / z elif z <= 2.9e+62: tmp = (y * (z + (x * (0.5 * (x * z))))) / (z * (x * z)) else: tmp = (0.5 * ((y * x) / z)) + (y / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.85e-74) tmp = Float64(Float64(Float64(y / x) + Float64(Float64(y * x) * 0.5)) / z); elseif (z <= 2.9e+62) tmp = Float64(Float64(y * Float64(z + Float64(x * Float64(0.5 * Float64(x * z))))) / Float64(z * Float64(x * z))); else tmp = Float64(Float64(0.5 * Float64(Float64(y * x) / z)) + Float64(y / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2.85e-74) tmp = ((y / x) + ((y * x) * 0.5)) / z; elseif (z <= 2.9e+62) tmp = (y * (z + (x * (0.5 * (x * z))))) / (z * (x * z)); else tmp = (0.5 * ((y * x) / z)) + (y / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.85e-74], N[(N[(N[(y / x), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 2.9e+62], N[(N[(y * N[(z + N[(x * N[(0.5 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.85 \cdot 10^{-74}:\\
\;\;\;\;\frac{\frac{y}{x} + \left(y \cdot x\right) \cdot 0.5}{z}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+62}:\\
\;\;\;\;\frac{y \cdot \left(z + x \cdot \left(0.5 \cdot \left(x \cdot z\right)\right)\right)}{z \cdot \left(x \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{z} + \frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 2.85000000000000012e-74Initial program 88.1%
Taylor expanded in x around 0 75.5%
if 2.85000000000000012e-74 < z < 2.89999999999999984e62Initial program 90.8%
associate-*l/90.8%
Simplified90.8%
Taylor expanded in x around 0 56.1%
associate-*r/56.1%
frac-add64.8%
*-commutative64.8%
*-commutative64.8%
associate-*l*64.8%
Applied egg-rr64.8%
associate-*l*70.6%
*-commutative70.6%
distribute-lft-out70.6%
associate-*l*70.6%
Applied egg-rr70.6%
if 2.89999999999999984e62 < z Initial program 72.5%
associate-*l/72.4%
Simplified72.4%
Taylor expanded in x around 0 57.5%
Final simplification71.6%
(FPCore (x y z) :precision binary64 (if (<= z 7.2e-116) (/ (+ (/ y x) (* (* y x) 0.5)) z) (/ (- (* z (/ y z)) (* x (* y (* x -0.5)))) (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 7.2e-116) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = ((z * (y / z)) - (x * (y * (x * -0.5)))) / (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 <= 7.2d-116) then
tmp = ((y / x) + ((y * x) * 0.5d0)) / z
else
tmp = ((z * (y / z)) - (x * (y * (x * (-0.5d0))))) / (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 7.2e-116) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = ((z * (y / z)) - (x * (y * (x * -0.5)))) / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 7.2e-116: tmp = ((y / x) + ((y * x) * 0.5)) / z else: tmp = ((z * (y / z)) - (x * (y * (x * -0.5)))) / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 7.2e-116) tmp = Float64(Float64(Float64(y / x) + Float64(Float64(y * x) * 0.5)) / z); else tmp = Float64(Float64(Float64(z * Float64(y / z)) - Float64(x * Float64(y * Float64(x * -0.5)))) / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 7.2e-116) tmp = ((y / x) + ((y * x) * 0.5)) / z; else tmp = ((z * (y / z)) - (x * (y * (x * -0.5)))) / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 7.2e-116], N[(N[(N[(y / x), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision] - N[(x * N[(y * N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.2 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{y}{x} + \left(y \cdot x\right) \cdot 0.5}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \frac{y}{z} - x \cdot \left(y \cdot \left(x \cdot -0.5\right)\right)}{x \cdot z}\\
\end{array}
\end{array}
if z < 7.19999999999999951e-116Initial program 88.0%
Taylor expanded in x around 0 75.1%
if 7.19999999999999951e-116 < z Initial program 81.3%
associate-*l/81.2%
Simplified81.2%
Taylor expanded in x around 0 59.6%
associate-*r/59.6%
clear-num59.6%
*-commutative59.6%
*-commutative59.6%
associate-*l*59.6%
Applied egg-rr59.6%
+-commutative59.6%
associate-/l/58.6%
frac-2neg58.6%
frac-2neg58.6%
clear-num58.6%
frac-add62.4%
distribute-neg-frac62.4%
associate-*r*62.4%
distribute-rgt-neg-in62.4%
metadata-eval62.4%
Applied egg-rr62.4%
*-commutative62.4%
*-commutative62.4%
distribute-rgt-neg-out62.4%
unsub-neg62.4%
distribute-frac-neg62.4%
distribute-rgt-neg-in62.4%
distribute-lft-neg-out62.4%
remove-double-neg62.4%
*-commutative62.4%
associate-*l*62.4%
distribute-lft-neg-out62.4%
distribute-rgt-neg-out62.4%
remove-double-neg62.4%
Simplified62.4%
Final simplification70.7%
(FPCore (x y z) :precision binary64 (if (<= z 6.8e+152) (/ (+ (/ y x) (* (* y x) 0.5)) z) (+ (/ y (* x z)) (* 0.5 (* x (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 6.8e+152) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = (y / (x * z)) + (0.5 * (x * (y / 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 <= 6.8d+152) then
tmp = ((y / x) + ((y * x) * 0.5d0)) / z
else
tmp = (y / (x * z)) + (0.5d0 * (x * (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 6.8e+152) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = (y / (x * z)) + (0.5 * (x * (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 6.8e+152: tmp = ((y / x) + ((y * x) * 0.5)) / z else: tmp = (y / (x * z)) + (0.5 * (x * (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 6.8e+152) tmp = Float64(Float64(Float64(y / x) + Float64(Float64(y * x) * 0.5)) / z); else tmp = Float64(Float64(y / Float64(x * z)) + Float64(0.5 * Float64(x * Float64(y / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 6.8e+152) tmp = ((y / x) + ((y * x) * 0.5)) / z; else tmp = (y / (x * z)) + (0.5 * (x * (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 6.8e+152], N[(N[(N[(y / x), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.8 \cdot 10^{+152}:\\
\;\;\;\;\frac{\frac{y}{x} + \left(y \cdot x\right) \cdot 0.5}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \left(x \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < 6.80000000000000041e152Initial program 88.4%
Taylor expanded in x around 0 70.7%
if 6.80000000000000041e152 < z Initial program 66.5%
associate-*l/66.5%
Simplified66.5%
Taylor expanded in x around 0 60.0%
div-inv60.0%
associate-*l*56.9%
Applied egg-rr56.9%
Taylor expanded in y around 0 56.9%
Final simplification69.0%
(FPCore (x y z) :precision binary64 (if (<= z 1.2e-191) (/ (+ (/ y x) (* (* y x) 0.5)) z) (+ (/ y (* x z)) (* 0.5 (* y (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.2e-191) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = (y / (x * z)) + (0.5 * (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 <= 1.2d-191) then
tmp = ((y / x) + ((y * x) * 0.5d0)) / z
else
tmp = (y / (x * z)) + (0.5d0 * (y * (x / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.2e-191) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = (y / (x * z)) + (0.5 * (y * (x / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.2e-191: tmp = ((y / x) + ((y * x) * 0.5)) / z else: tmp = (y / (x * z)) + (0.5 * (y * (x / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.2e-191) tmp = Float64(Float64(Float64(y / x) + Float64(Float64(y * x) * 0.5)) / z); else tmp = Float64(Float64(y / Float64(x * z)) + Float64(0.5 * Float64(y * Float64(x / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.2e-191) tmp = ((y / x) + ((y * x) * 0.5)) / z; else tmp = (y / (x * z)) + (0.5 * (y * (x / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.2e-191], N[(N[(N[(y / x), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.2 \cdot 10^{-191}:\\
\;\;\;\;\frac{\frac{y}{x} + \left(y \cdot x\right) \cdot 0.5}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if z < 1.2e-191Initial program 87.8%
Taylor expanded in x around 0 74.5%
if 1.2e-191 < z Initial program 82.5%
associate-*l/82.4%
Simplified82.4%
Taylor expanded in x around 0 62.5%
associate-/l*60.5%
associate-/r/61.5%
Applied egg-rr61.5%
Final simplification69.3%
(FPCore (x y z) :precision binary64 (if (<= z 2e+32) (/ (+ (/ y x) (* (* y x) 0.5)) z) (+ (* 0.5 (/ (* y x) z)) (/ y (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2e+32) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = (0.5 * ((y * x) / z)) + (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 <= 2d+32) then
tmp = ((y / x) + ((y * x) * 0.5d0)) / z
else
tmp = (0.5d0 * ((y * x) / z)) + (y / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2e+32) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = (0.5 * ((y * x) / z)) + (y / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2e+32: tmp = ((y / x) + ((y * x) * 0.5)) / z else: tmp = (0.5 * ((y * x) / z)) + (y / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2e+32) tmp = Float64(Float64(Float64(y / x) + Float64(Float64(y * x) * 0.5)) / z); else tmp = Float64(Float64(0.5 * Float64(Float64(y * x) / z)) + Float64(y / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2e+32) tmp = ((y / x) + ((y * x) * 0.5)) / z; else tmp = (0.5 * ((y * x) / z)) + (y / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2e+32], N[(N[(N[(y / x), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(0.5 * N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{+32}:\\
\;\;\;\;\frac{\frac{y}{x} + \left(y \cdot x\right) \cdot 0.5}{z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{z} + \frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 2.00000000000000011e32Initial program 88.6%
Taylor expanded in x around 0 73.8%
if 2.00000000000000011e32 < z Initial program 74.7%
associate-*l/74.6%
Simplified74.6%
Taylor expanded in x around 0 54.8%
Final simplification69.8%
(FPCore (x y z) :precision binary64 (if (<= z 1.45e+153) (/ (* y (+ (* x 0.5) (/ 1.0 x))) z) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.45e+153) {
tmp = (y * ((x * 0.5) + (1.0 / 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 (z <= 1.45d+153) then
tmp = (y * ((x * 0.5d0) + (1.0d0 / 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 (z <= 1.45e+153) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z;
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.45e+153: tmp = (y * ((x * 0.5) + (1.0 / x))) / z else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.45e+153) tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.45e+153) tmp = (y * ((x * 0.5) + (1.0 / x))) / z; else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.45e+153], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.45 \cdot 10^{+153}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 1.45000000000000001e153Initial program 88.4%
expm1-log1p-u51.4%
expm1-udef41.5%
Applied egg-rr41.5%
expm1-def51.4%
expm1-log1p88.4%
associate-*r/97.8%
associate-*l/97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 70.7%
if 1.45000000000000001e153 < z Initial program 66.5%
associate-*l/66.5%
Simplified66.5%
Taylor expanded in x around 0 56.7%
Final simplification68.9%
(FPCore (x y z) :precision binary64 (if (<= z 1.65e+151) (/ (+ (/ y x) (* (* y x) 0.5)) z) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.65e+151) {
tmp = ((y / x) + ((y * x) * 0.5)) / 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 (z <= 1.65d+151) then
tmp = ((y / x) + ((y * x) * 0.5d0)) / 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 (z <= 1.65e+151) {
tmp = ((y / x) + ((y * x) * 0.5)) / z;
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.65e+151: tmp = ((y / x) + ((y * x) * 0.5)) / z else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.65e+151) tmp = Float64(Float64(Float64(y / x) + Float64(Float64(y * x) * 0.5)) / z); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.65e+151) tmp = ((y / x) + ((y * x) * 0.5)) / z; else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.65e+151], N[(N[(N[(y / x), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.65 \cdot 10^{+151}:\\
\;\;\;\;\frac{\frac{y}{x} + \left(y \cdot x\right) \cdot 0.5}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 1.65000000000000012e151Initial program 88.4%
Taylor expanded in x around 0 70.7%
if 1.65000000000000012e151 < z Initial program 66.5%
associate-*l/66.5%
Simplified66.5%
Taylor expanded in x around 0 56.7%
Final simplification69.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.45))) (* x (* 0.5 (/ y z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.45)) {
tmp = x * (0.5 * (y / 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 <= (-1.4d0)) .or. (.not. (x <= 1.45d0))) then
tmp = x * (0.5d0 * (y / 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 <= -1.4) || !(x <= 1.45)) {
tmp = x * (0.5 * (y / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.45): tmp = x * (0.5 * (y / z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.45)) tmp = Float64(x * Float64(0.5 * Float64(y / z))); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4) || ~((x <= 1.45))) tmp = x * (0.5 * (y / z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.45]], $MachinePrecision]], N[(x * N[(0.5 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.45\right):\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.44999999999999996 < x Initial program 79.5%
expm1-log1p-u36.2%
expm1-udef35.5%
Applied egg-rr35.5%
expm1-def36.2%
expm1-log1p79.5%
associate-*r/100.0%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 42.3%
Taylor expanded in x around inf 42.3%
*-commutative42.3%
associate-/l*37.8%
associate-*r/37.8%
associate-/l*42.3%
associate-*r/39.3%
*-commutative39.3%
associate-*l/42.3%
associate-*r/34.0%
*-commutative34.0%
associate-*l/34.0%
Simplified34.0%
if -1.3999999999999999 < x < 1.44999999999999996Initial program 91.7%
associate-*l/91.7%
Simplified91.7%
Taylor expanded in x around 0 90.4%
*-un-lft-identity90.4%
times-frac93.4%
Applied egg-rr93.4%
associate-*l/93.5%
*-un-lft-identity93.5%
Applied egg-rr93.5%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.45))) (* y (* 0.5 (/ x z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.45)) {
tmp = y * (0.5 * (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 <= (-1.4d0)) .or. (.not. (x <= 1.45d0))) then
tmp = y * (0.5d0 * (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 <= -1.4) || !(x <= 1.45)) {
tmp = y * (0.5 * (x / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.45): tmp = y * (0.5 * (x / z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.45)) tmp = Float64(y * Float64(0.5 * 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 <= -1.4) || ~((x <= 1.45))) tmp = y * (0.5 * (x / z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.45]], $MachinePrecision]], N[(y * N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.45\right):\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.44999999999999996 < x Initial program 79.5%
expm1-log1p-u36.2%
expm1-udef35.5%
Applied egg-rr35.5%
expm1-def36.2%
expm1-log1p79.5%
associate-*r/100.0%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 42.3%
Taylor expanded in x around inf 42.3%
associate-*r/42.3%
associate-*r*42.3%
associate-*l/39.3%
associate-*r/39.3%
*-commutative39.3%
Simplified39.3%
if -1.3999999999999999 < x < 1.44999999999999996Initial program 91.7%
associate-*l/91.7%
Simplified91.7%
Taylor expanded in x around 0 90.4%
*-un-lft-identity90.4%
times-frac93.4%
Applied egg-rr93.4%
associate-*l/93.5%
*-un-lft-identity93.5%
Applied egg-rr93.5%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.45))) (/ (* (* y x) 0.5) z) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.45)) {
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 <= (-1.4d0)) .or. (.not. (x <= 1.45d0))) 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 <= -1.4) || !(x <= 1.45)) {
tmp = ((y * x) * 0.5) / z;
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.45): tmp = ((y * x) * 0.5) / z else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.45)) tmp = Float64(Float64(Float64(y * x) * 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 <= -1.4) || ~((x <= 1.45))) tmp = ((y * x) * 0.5) / z; else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.45]], $MachinePrecision]], N[(N[(N[(y * x), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.45\right):\\
\;\;\;\;\frac{\left(y \cdot x\right) \cdot 0.5}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.44999999999999996 < x Initial program 79.5%
Taylor expanded in x around 0 42.3%
Taylor expanded in x around inf 42.3%
*-commutative42.3%
Simplified42.3%
if -1.3999999999999999 < x < 1.44999999999999996Initial program 91.7%
associate-*l/91.7%
Simplified91.7%
Taylor expanded in x around 0 90.4%
*-un-lft-identity90.4%
times-frac93.4%
Applied egg-rr93.4%
associate-*l/93.5%
*-un-lft-identity93.5%
Applied egg-rr93.5%
Final simplification68.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.95e-124) (/ (/ y x) z) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.95e-124) {
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 <= 2.95d-124) 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 <= 2.95e-124) {
tmp = (y / x) / z;
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.95e-124: tmp = (y / x) / z else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.95e-124) tmp = Float64(Float64(y / x) / z); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.95e-124) tmp = (y / x) / z; else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.95e-124], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.95 \cdot 10^{-124}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if y < 2.9500000000000001e-124Initial program 81.9%
Taylor expanded in x around 0 49.9%
if 2.9500000000000001e-124 < y Initial program 91.9%
associate-*l/91.8%
Simplified91.8%
Taylor expanded in x around 0 55.3%
Final simplification51.9%
(FPCore (x y z) :precision binary64 (if (<= z -20000.0) (/ y (* x z)) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -20000.0) {
tmp = y / (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 (z <= (-20000.0d0)) then
tmp = y / (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 (z <= -20000.0) {
tmp = y / (x * z);
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -20000.0: tmp = y / (x * z) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -20000.0) tmp = Float64(y / 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 (z <= -20000.0) tmp = y / (x * z); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -20000.0], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -20000:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if z < -2e4Initial program 83.3%
associate-*l/83.3%
Simplified83.3%
Taylor expanded in x around 0 45.6%
if -2e4 < z Initial program 86.5%
associate-*l/86.4%
Simplified86.4%
Taylor expanded in x around 0 49.9%
*-un-lft-identity49.9%
times-frac61.8%
Applied egg-rr61.8%
associate-*l/61.9%
*-un-lft-identity61.9%
Applied egg-rr61.9%
Final simplification57.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 85.7%
associate-*l/85.6%
Simplified85.6%
Taylor expanded in x around 0 48.8%
Final simplification48.8%
(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 2023332
(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))