
(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 (<= t_0 4e+49) (/ t_0 z) (/ y (/ x (/ (cosh x) z))))))
double code(double x, double y, double z) {
double t_0 = cosh(x) * (y / x);
double tmp;
if (t_0 <= 4e+49) {
tmp = t_0 / z;
} else {
tmp = y / (x / (cosh(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 = cosh(x) * (y / x)
if (t_0 <= 4d+49) then
tmp = t_0 / z
else
tmp = y / (x / (cosh(x) / 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 <= 4e+49) {
tmp = t_0 / z;
} else {
tmp = y / (x / (Math.cosh(x) / z));
}
return tmp;
}
def code(x, y, z): t_0 = math.cosh(x) * (y / x) tmp = 0 if t_0 <= 4e+49: tmp = t_0 / z else: tmp = y / (x / (math.cosh(x) / z)) return tmp
function code(x, y, z) t_0 = Float64(cosh(x) * Float64(y / x)) tmp = 0.0 if (t_0 <= 4e+49) tmp = Float64(t_0 / z); else tmp = Float64(y / Float64(x / Float64(cosh(x) / z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = cosh(x) * (y / x); tmp = 0.0; if (t_0 <= 4e+49) tmp = t_0 / z; else tmp = y / (x / (cosh(x) / 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[LessEqual[t$95$0, 4e+49], N[(t$95$0 / z), $MachinePrecision], N[(y / N[(x / N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{+49}:\\
\;\;\;\;\frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{x}{\frac{\cosh x}{z}}}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 3.99999999999999979e49Initial program 97.8%
if 3.99999999999999979e49 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 68.4%
associate-*r/94.2%
associate-/l/83.5%
associate-*l/83.5%
*-commutative83.5%
*-commutative83.5%
Simplified83.5%
clear-num83.5%
un-div-inv83.5%
associate-/l*99.9%
Applied egg-rr99.9%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (<= x -7.5e+167) (* (/ (* y (* x z)) (* z (/ z x))) (/ 0.5 x)) (* y (/ (cosh x) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e+167) {
tmp = ((y * (x * z)) / (z * (z / x))) * (0.5 / x);
} else {
tmp = y * (cosh(x) / (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 (x <= (-7.5d+167)) then
tmp = ((y * (x * z)) / (z * (z / x))) * (0.5d0 / x)
else
tmp = y * (cosh(x) / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e+167) {
tmp = ((y * (x * z)) / (z * (z / x))) * (0.5 / x);
} else {
tmp = y * (Math.cosh(x) / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.5e+167: tmp = ((y * (x * z)) / (z * (z / x))) * (0.5 / x) else: tmp = y * (math.cosh(x) / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.5e+167) tmp = Float64(Float64(Float64(y * Float64(x * z)) / Float64(z * Float64(z / x))) * Float64(0.5 / x)); else tmp = Float64(y * Float64(cosh(x) / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.5e+167) tmp = ((y * (x * z)) / (z * (z / x))) * (0.5 / x); else tmp = y * (cosh(x) / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.5e+167], N[(N[(N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+167}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot z\right)}{z \cdot \frac{z}{x}} \cdot \frac{0.5}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if x < -7.4999999999999995e167Initial program 50.0%
associate-*r/100.0%
associate-/l/50.0%
associate-*l/50.0%
*-commutative50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in x around 0 45.5%
+-commutative45.5%
associate-/l*39.0%
*-commutative39.0%
associate-/r*39.0%
Simplified39.0%
associate-/l/39.0%
+-commutative39.0%
associate-*r/39.0%
frac-add40.4%
*-commutative40.4%
*-commutative40.4%
Applied egg-rr40.4%
+-commutative40.4%
associate-*r*40.4%
*-commutative40.4%
distribute-rgt-out40.4%
associate-*l*40.5%
associate-*l*60.5%
Simplified60.5%
Taylor expanded in x around inf 63.7%
*-commutative63.7%
*-commutative63.7%
times-frac83.5%
Applied egg-rr83.5%
if -7.4999999999999995e167 < x Initial program 89.0%
associate-*r/95.7%
associate-/l/92.1%
associate-*l/92.1%
*-commutative92.1%
*-commutative92.1%
Simplified92.1%
Final simplification91.1%
(FPCore (x y z) :precision binary64 (/ y (/ x (/ (cosh x) z))))
double code(double x, double y, double z) {
return y / (x / (cosh(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 / (cosh(x) / z))
end function
public static double code(double x, double y, double z) {
return y / (x / (Math.cosh(x) / z));
}
def code(x, y, z): return y / (x / (math.cosh(x) / z))
function code(x, y, z) return Float64(y / Float64(x / Float64(cosh(x) / z))) end
function tmp = code(x, y, z) tmp = y / (x / (cosh(x) / z)); end
code[x_, y_, z_] := N[(y / N[(x / N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{\frac{x}{\frac{\cosh x}{z}}}
\end{array}
Initial program 84.4%
associate-*r/96.2%
associate-/l/87.2%
associate-*l/87.2%
*-commutative87.2%
*-commutative87.2%
Simplified87.2%
clear-num87.2%
un-div-inv87.2%
associate-/l*96.6%
Applied egg-rr96.6%
Final simplification96.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (* x z))))
(if (<= x -1.2e+40)
(/ (* t_0 0.5) (* z z))
(if (<= x 125000.0)
(* y (+ (* 0.5 (/ x z)) (/ (/ 1.0 x) z)))
(if (<= x 2.8e+127)
(* (/ (* y 0.5) x) (/ (* x z) (* z (/ z x))))
(* (/ 0.5 (* x z)) (/ t_0 (/ z x))))))))
double code(double x, double y, double z) {
double t_0 = y * (x * z);
double tmp;
if (x <= -1.2e+40) {
tmp = (t_0 * 0.5) / (z * z);
} else if (x <= 125000.0) {
tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z));
} else if (x <= 2.8e+127) {
tmp = ((y * 0.5) / x) * ((x * z) / (z * (z / x)));
} else {
tmp = (0.5 / (x * z)) * (t_0 / (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) :: t_0
real(8) :: tmp
t_0 = y * (x * z)
if (x <= (-1.2d+40)) then
tmp = (t_0 * 0.5d0) / (z * z)
else if (x <= 125000.0d0) then
tmp = y * ((0.5d0 * (x / z)) + ((1.0d0 / x) / z))
else if (x <= 2.8d+127) then
tmp = ((y * 0.5d0) / x) * ((x * z) / (z * (z / x)))
else
tmp = (0.5d0 / (x * z)) * (t_0 / (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x * z);
double tmp;
if (x <= -1.2e+40) {
tmp = (t_0 * 0.5) / (z * z);
} else if (x <= 125000.0) {
tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z));
} else if (x <= 2.8e+127) {
tmp = ((y * 0.5) / x) * ((x * z) / (z * (z / x)));
} else {
tmp = (0.5 / (x * z)) * (t_0 / (z / x));
}
return tmp;
}
def code(x, y, z): t_0 = y * (x * z) tmp = 0 if x <= -1.2e+40: tmp = (t_0 * 0.5) / (z * z) elif x <= 125000.0: tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)) elif x <= 2.8e+127: tmp = ((y * 0.5) / x) * ((x * z) / (z * (z / x))) else: tmp = (0.5 / (x * z)) * (t_0 / (z / x)) return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x * z)) tmp = 0.0 if (x <= -1.2e+40) tmp = Float64(Float64(t_0 * 0.5) / Float64(z * z)); elseif (x <= 125000.0) tmp = Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(Float64(1.0 / x) / z))); elseif (x <= 2.8e+127) tmp = Float64(Float64(Float64(y * 0.5) / x) * Float64(Float64(x * z) / Float64(z * Float64(z / x)))); else tmp = Float64(Float64(0.5 / Float64(x * z)) * Float64(t_0 / Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x * z); tmp = 0.0; if (x <= -1.2e+40) tmp = (t_0 * 0.5) / (z * z); elseif (x <= 125000.0) tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)); elseif (x <= 2.8e+127) tmp = ((y * 0.5) / x) * ((x * z) / (z * (z / x))); else tmp = (0.5 / (x * z)) * (t_0 / (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.2e+40], N[(N[(t$95$0 * 0.5), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 125000.0], N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+127], N[(N[(N[(y * 0.5), $MachinePrecision] / x), $MachinePrecision] * N[(N[(x * z), $MachinePrecision] / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / N[(x * z), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{+40}:\\
\;\;\;\;\frac{t_0 \cdot 0.5}{z \cdot z}\\
\mathbf{elif}\;x \leq 125000:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{\frac{1}{x}}{z}\right)\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+127}:\\
\;\;\;\;\frac{y \cdot 0.5}{x} \cdot \frac{x \cdot z}{z \cdot \frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x \cdot z} \cdot \frac{t_0}{\frac{z}{x}}\\
\end{array}
\end{array}
if x < -1.2e40Initial program 65.2%
associate-*r/100.0%
associate-/l/63.0%
associate-*l/63.0%
*-commutative63.0%
*-commutative63.0%
Simplified63.0%
Taylor expanded in x around 0 39.5%
+-commutative39.5%
associate-/l*33.2%
*-commutative33.2%
associate-/r*33.2%
Simplified33.2%
associate-/l/33.2%
+-commutative33.2%
associate-*r/33.2%
frac-add42.0%
*-commutative42.0%
*-commutative42.0%
Applied egg-rr42.0%
+-commutative42.0%
associate-*r*42.0%
*-commutative42.0%
distribute-rgt-out42.0%
associate-*l*42.1%
associate-*l*57.2%
Simplified57.2%
Taylor expanded in x around inf 59.4%
Taylor expanded in x around 0 55.2%
unpow255.2%
Simplified55.2%
if -1.2e40 < x < 125000Initial program 92.8%
associate-*r/92.8%
associate-/l/93.5%
associate-*l/93.5%
*-commutative93.5%
*-commutative93.5%
Simplified93.5%
Taylor expanded in x around 0 88.2%
associate-/l/88.3%
+-commutative88.3%
Simplified88.3%
if 125000 < x < 2.8000000000000002e127Initial program 96.9%
associate-*r/100.0%
associate-/l/96.9%
associate-*l/96.9%
*-commutative96.9%
*-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 34.1%
+-commutative34.1%
associate-/l*40.1%
*-commutative40.1%
associate-/r*40.1%
Simplified40.1%
associate-/l/40.1%
+-commutative40.1%
associate-*r/40.1%
frac-add45.0%
*-commutative45.0%
*-commutative45.0%
Applied egg-rr45.0%
+-commutative45.0%
associate-*r*45.0%
*-commutative45.0%
distribute-rgt-out45.0%
associate-*l*45.0%
associate-*l*50.7%
Simplified50.7%
Taylor expanded in x around inf 50.7%
associate-*r*50.7%
times-frac60.5%
*-commutative60.5%
Applied egg-rr60.5%
if 2.8000000000000002e127 < x Initial program 69.0%
associate-*r/100.0%
associate-/l/85.7%
associate-*l/85.7%
*-commutative85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in x around 0 50.2%
+-commutative50.2%
associate-/l*59.0%
*-commutative59.0%
associate-/r*59.0%
Simplified59.0%
associate-/l/59.0%
+-commutative59.0%
associate-*r/59.0%
frac-add58.3%
*-commutative58.3%
*-commutative58.3%
Applied egg-rr58.3%
+-commutative58.3%
associate-*r*58.3%
*-commutative58.3%
distribute-rgt-out58.3%
associate-*l*58.3%
associate-*l*65.3%
Simplified65.3%
Taylor expanded in x around inf 65.3%
associate-*r*58.3%
*-commutative58.3%
times-frac69.4%
Applied egg-rr69.4%
Final simplification75.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.4e+39) (not (<= x 125000.0))) (* (/ (* y 0.5) (* z (/ z x))) (/ (* x z) x)) (* y (+ (* 0.5 (/ x z)) (/ (/ 1.0 x) z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.4e+39) || !(x <= 125000.0)) {
tmp = ((y * 0.5) / (z * (z / x))) * ((x * z) / x);
} else {
tmp = y * ((0.5 * (x / 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) :: tmp
if ((x <= (-3.4d+39)) .or. (.not. (x <= 125000.0d0))) then
tmp = ((y * 0.5d0) / (z * (z / x))) * ((x * z) / x)
else
tmp = y * ((0.5d0 * (x / z)) + ((1.0d0 / x) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.4e+39) || !(x <= 125000.0)) {
tmp = ((y * 0.5) / (z * (z / x))) * ((x * z) / x);
} else {
tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.4e+39) or not (x <= 125000.0): tmp = ((y * 0.5) / (z * (z / x))) * ((x * z) / x) else: tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.4e+39) || !(x <= 125000.0)) tmp = Float64(Float64(Float64(y * 0.5) / Float64(z * Float64(z / x))) * Float64(Float64(x * z) / x)); else tmp = Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(Float64(1.0 / x) / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.4e+39) || ~((x <= 125000.0))) tmp = ((y * 0.5) / (z * (z / x))) * ((x * z) / x); else tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.4e+39], N[Not[LessEqual[x, 125000.0]], $MachinePrecision]], N[(N[(N[(y * 0.5), $MachinePrecision] / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(x * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+39} \lor \neg \left(x \leq 125000\right):\\
\;\;\;\;\frac{y \cdot 0.5}{z \cdot \frac{z}{x}} \cdot \frac{x \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{\frac{1}{x}}{z}\right)\\
\end{array}
\end{array}
if x < -3.3999999999999999e39 or 125000 < x Initial program 75.0%
associate-*r/100.0%
associate-/l/80.0%
associate-*l/80.0%
*-commutative80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in x around 0 41.8%
+-commutative41.8%
associate-/l*44.1%
*-commutative44.1%
associate-/r*44.1%
Simplified44.1%
associate-/l/44.1%
+-commutative44.1%
associate-*r/44.1%
frac-add48.5%
*-commutative48.5%
*-commutative48.5%
Applied egg-rr48.5%
+-commutative48.5%
associate-*r*48.5%
*-commutative48.5%
distribute-rgt-out48.5%
associate-*l*48.5%
associate-*l*58.3%
Simplified58.3%
Taylor expanded in x around inf 59.1%
associate-*r*59.1%
*-commutative59.1%
times-frac62.9%
*-commutative62.9%
Applied egg-rr62.9%
if -3.3999999999999999e39 < x < 125000Initial program 92.8%
associate-*r/92.8%
associate-/l/93.5%
associate-*l/93.5%
*-commutative93.5%
*-commutative93.5%
Simplified93.5%
Taylor expanded in x around 0 88.2%
associate-/l/88.3%
+-commutative88.3%
Simplified88.3%
Final simplification76.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -21500000.0) (not (<= x 125000.0))) (* (/ (* y (* x z)) (* z (/ z x))) (/ 0.5 x)) (* y (+ (* 0.5 (/ x z)) (/ (/ 1.0 x) z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -21500000.0) || !(x <= 125000.0)) {
tmp = ((y * (x * z)) / (z * (z / x))) * (0.5 / x);
} else {
tmp = y * ((0.5 * (x / 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) :: tmp
if ((x <= (-21500000.0d0)) .or. (.not. (x <= 125000.0d0))) then
tmp = ((y * (x * z)) / (z * (z / x))) * (0.5d0 / x)
else
tmp = y * ((0.5d0 * (x / z)) + ((1.0d0 / x) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -21500000.0) || !(x <= 125000.0)) {
tmp = ((y * (x * z)) / (z * (z / x))) * (0.5 / x);
} else {
tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -21500000.0) or not (x <= 125000.0): tmp = ((y * (x * z)) / (z * (z / x))) * (0.5 / x) else: tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -21500000.0) || !(x <= 125000.0)) tmp = Float64(Float64(Float64(y * Float64(x * z)) / Float64(z * Float64(z / x))) * Float64(0.5 / x)); else tmp = Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(Float64(1.0 / x) / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -21500000.0) || ~((x <= 125000.0))) tmp = ((y * (x * z)) / (z * (z / x))) * (0.5 / x); else tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -21500000.0], N[Not[LessEqual[x, 125000.0]], $MachinePrecision]], N[(N[(N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -21500000 \lor \neg \left(x \leq 125000\right):\\
\;\;\;\;\frac{y \cdot \left(x \cdot z\right)}{z \cdot \frac{z}{x}} \cdot \frac{0.5}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{\frac{1}{x}}{z}\right)\\
\end{array}
\end{array}
if x < -2.15e7 or 125000 < x Initial program 75.8%
associate-*r/100.0%
associate-/l/80.6%
associate-*l/80.6%
*-commutative80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in x around 0 42.1%
+-commutative42.1%
associate-/l*44.3%
*-commutative44.3%
associate-/r*44.3%
Simplified44.3%
associate-/l/44.3%
+-commutative44.3%
associate-*r/44.3%
frac-add48.6%
*-commutative48.6%
*-commutative48.6%
Applied egg-rr48.6%
+-commutative48.6%
associate-*r*48.6%
*-commutative48.6%
distribute-rgt-out48.6%
associate-*l*48.6%
associate-*l*58.1%
Simplified58.1%
Taylor expanded in x around inf 58.9%
*-commutative58.9%
*-commutative58.9%
times-frac70.0%
Applied egg-rr70.0%
if -2.15e7 < x < 125000Initial program 92.6%
associate-*r/92.6%
associate-/l/93.3%
associate-*l/93.3%
*-commutative93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in x around 0 89.3%
associate-/l/89.4%
+-commutative89.4%
Simplified89.4%
Final simplification80.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (* x z))))
(if (<= x -3.4e+39)
(/ (* t_0 0.5) (* z z))
(if (<= x 1.2e+121)
(* y (+ (* 0.5 (/ x z)) (/ (/ 1.0 x) z)))
(* (/ 0.5 (* x z)) (/ t_0 (/ z x)))))))
double code(double x, double y, double z) {
double t_0 = y * (x * z);
double tmp;
if (x <= -3.4e+39) {
tmp = (t_0 * 0.5) / (z * z);
} else if (x <= 1.2e+121) {
tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z));
} else {
tmp = (0.5 / (x * z)) * (t_0 / (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) :: t_0
real(8) :: tmp
t_0 = y * (x * z)
if (x <= (-3.4d+39)) then
tmp = (t_0 * 0.5d0) / (z * z)
else if (x <= 1.2d+121) then
tmp = y * ((0.5d0 * (x / z)) + ((1.0d0 / x) / z))
else
tmp = (0.5d0 / (x * z)) * (t_0 / (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x * z);
double tmp;
if (x <= -3.4e+39) {
tmp = (t_0 * 0.5) / (z * z);
} else if (x <= 1.2e+121) {
tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z));
} else {
tmp = (0.5 / (x * z)) * (t_0 / (z / x));
}
return tmp;
}
def code(x, y, z): t_0 = y * (x * z) tmp = 0 if x <= -3.4e+39: tmp = (t_0 * 0.5) / (z * z) elif x <= 1.2e+121: tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)) else: tmp = (0.5 / (x * z)) * (t_0 / (z / x)) return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x * z)) tmp = 0.0 if (x <= -3.4e+39) tmp = Float64(Float64(t_0 * 0.5) / Float64(z * z)); elseif (x <= 1.2e+121) tmp = Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(Float64(1.0 / x) / z))); else tmp = Float64(Float64(0.5 / Float64(x * z)) * Float64(t_0 / Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x * z); tmp = 0.0; if (x <= -3.4e+39) tmp = (t_0 * 0.5) / (z * z); elseif (x <= 1.2e+121) tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)); else tmp = (0.5 / (x * z)) * (t_0 / (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e+39], N[(N[(t$95$0 * 0.5), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e+121], N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / N[(x * z), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{+39}:\\
\;\;\;\;\frac{t_0 \cdot 0.5}{z \cdot z}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+121}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{\frac{1}{x}}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x \cdot z} \cdot \frac{t_0}{\frac{z}{x}}\\
\end{array}
\end{array}
if x < -3.3999999999999999e39Initial program 65.2%
associate-*r/100.0%
associate-/l/63.0%
associate-*l/63.0%
*-commutative63.0%
*-commutative63.0%
Simplified63.0%
Taylor expanded in x around 0 39.5%
+-commutative39.5%
associate-/l*33.2%
*-commutative33.2%
associate-/r*33.2%
Simplified33.2%
associate-/l/33.2%
+-commutative33.2%
associate-*r/33.2%
frac-add42.0%
*-commutative42.0%
*-commutative42.0%
Applied egg-rr42.0%
+-commutative42.0%
associate-*r*42.0%
*-commutative42.0%
distribute-rgt-out42.0%
associate-*l*42.1%
associate-*l*57.2%
Simplified57.2%
Taylor expanded in x around inf 59.4%
Taylor expanded in x around 0 55.2%
unpow255.2%
Simplified55.2%
if -3.3999999999999999e39 < x < 1.2e121Initial program 93.4%
associate-*r/94.0%
associate-/l/94.1%
associate-*l/94.0%
*-commutative94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in x around 0 79.8%
associate-/l/79.9%
+-commutative79.9%
Simplified79.9%
if 1.2e121 < x Initial program 71.1%
associate-*r/100.0%
associate-/l/86.7%
associate-*l/86.7%
*-commutative86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around 0 51.4%
+-commutative51.4%
associate-/l*59.6%
*-commutative59.6%
associate-/r*59.6%
Simplified59.6%
associate-/l/59.6%
+-commutative59.6%
associate-*r/59.6%
frac-add59.0%
*-commutative59.0%
*-commutative59.0%
Applied egg-rr59.0%
+-commutative59.0%
associate-*r*59.0%
*-commutative59.0%
distribute-rgt-out59.0%
associate-*l*59.0%
associate-*l*67.6%
Simplified67.6%
Taylor expanded in x around inf 67.6%
associate-*r*59.0%
*-commutative59.0%
times-frac69.3%
Applied egg-rr69.3%
Final simplification73.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -960.0) (not (<= x 125000.0))) (/ (* (* y (* x z)) 0.5) (* z z)) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -960.0) || !(x <= 125000.0)) {
tmp = ((y * (x * z)) * 0.5) / (z * 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 ((x <= (-960.0d0)) .or. (.not. (x <= 125000.0d0))) then
tmp = ((y * (x * z)) * 0.5d0) / (z * 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 ((x <= -960.0) || !(x <= 125000.0)) {
tmp = ((y * (x * z)) * 0.5) / (z * z);
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -960.0) or not (x <= 125000.0): tmp = ((y * (x * z)) * 0.5) / (z * z) else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -960.0) || !(x <= 125000.0)) tmp = Float64(Float64(Float64(y * Float64(x * z)) * 0.5) / Float64(z * z)); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -960.0) || ~((x <= 125000.0))) tmp = ((y * (x * z)) * 0.5) / (z * z); else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -960.0], N[Not[LessEqual[x, 125000.0]], $MachinePrecision]], N[(N[(N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -960 \lor \neg \left(x \leq 125000\right):\\
\;\;\;\;\frac{\left(y \cdot \left(x \cdot z\right)\right) \cdot 0.5}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if x < -960 or 125000 < x Initial program 76.0%
associate-*r/100.0%
associate-/l/80.8%
associate-*l/80.8%
*-commutative80.8%
*-commutative80.8%
Simplified80.8%
Taylor expanded in x around 0 41.8%
+-commutative41.8%
associate-/l*44.0%
*-commutative44.0%
associate-/r*44.0%
Simplified44.0%
associate-/l/44.0%
+-commutative44.0%
associate-*r/44.0%
frac-add48.3%
*-commutative48.3%
*-commutative48.3%
Applied egg-rr48.3%
+-commutative48.3%
associate-*r*48.3%
*-commutative48.3%
distribute-rgt-out48.3%
associate-*l*48.3%
associate-*l*57.7%
Simplified57.7%
Taylor expanded in x around inf 58.4%
Taylor expanded in x around 0 54.0%
unpow254.0%
Simplified54.0%
if -960 < x < 125000Initial program 92.5%
associate-*r/92.5%
associate-/l/93.3%
associate-*l/93.2%
*-commutative93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in x around 0 89.6%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (<= x -4.2e+39) (/ (* (* y (* x z)) 0.5) (* z z)) (* y (+ (* 0.5 (/ x z)) (/ (/ 1.0 x) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.2e+39) {
tmp = ((y * (x * z)) * 0.5) / (z * z);
} else {
tmp = y * ((0.5 * (x / 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) :: tmp
if (x <= (-4.2d+39)) then
tmp = ((y * (x * z)) * 0.5d0) / (z * z)
else
tmp = y * ((0.5d0 * (x / z)) + ((1.0d0 / x) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.2e+39) {
tmp = ((y * (x * z)) * 0.5) / (z * z);
} else {
tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.2e+39: tmp = ((y * (x * z)) * 0.5) / (z * z) else: tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.2e+39) tmp = Float64(Float64(Float64(y * Float64(x * z)) * 0.5) / Float64(z * z)); else tmp = Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(Float64(1.0 / x) / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.2e+39) tmp = ((y * (x * z)) * 0.5) / (z * z); else tmp = y * ((0.5 * (x / z)) + ((1.0 / x) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.2e+39], N[(N[(N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+39}:\\
\;\;\;\;\frac{\left(y \cdot \left(x \cdot z\right)\right) \cdot 0.5}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{\frac{1}{x}}{z}\right)\\
\end{array}
\end{array}
if x < -4.1999999999999997e39Initial program 65.2%
associate-*r/100.0%
associate-/l/63.0%
associate-*l/63.0%
*-commutative63.0%
*-commutative63.0%
Simplified63.0%
Taylor expanded in x around 0 39.5%
+-commutative39.5%
associate-/l*33.2%
*-commutative33.2%
associate-/r*33.2%
Simplified33.2%
associate-/l/33.2%
+-commutative33.2%
associate-*r/33.2%
frac-add42.0%
*-commutative42.0%
*-commutative42.0%
Applied egg-rr42.0%
+-commutative42.0%
associate-*r*42.0%
*-commutative42.0%
distribute-rgt-out42.0%
associate-*l*42.1%
associate-*l*57.2%
Simplified57.2%
Taylor expanded in x around inf 59.4%
Taylor expanded in x around 0 55.2%
unpow255.2%
Simplified55.2%
if -4.1999999999999997e39 < x Initial program 88.7%
associate-*r/95.3%
associate-/l/92.5%
associate-*l/92.4%
*-commutative92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in x around 0 75.5%
associate-/l/75.5%
+-commutative75.5%
Simplified75.5%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.45) (not (<= x 1.4))) (* 0.5 (* y (/ x z))) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.45) || !(x <= 1.4)) {
tmp = 0.5 * (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 ((x <= (-1.45d0)) .or. (.not. (x <= 1.4d0))) then
tmp = 0.5d0 * (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 ((x <= -1.45) || !(x <= 1.4)) {
tmp = 0.5 * (y * (x / z));
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.45) or not (x <= 1.4): tmp = 0.5 * (y * (x / z)) else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.45) || !(x <= 1.4)) tmp = Float64(0.5 * Float64(y * Float64(x / z))); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.45) || ~((x <= 1.4))) tmp = 0.5 * (y * (x / z)); else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.45], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if x < -1.44999999999999996 or 1.3999999999999999 < x Initial program 76.2%
Taylor expanded in x around 0 40.6%
Taylor expanded in x around inf 40.6%
associate-*r/43.4%
Simplified43.4%
if -1.44999999999999996 < x < 1.3999999999999999Initial program 93.0%
associate-*r/93.0%
associate-/l/93.8%
associate-*l/93.7%
*-commutative93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in x around 0 92.8%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (<= x -1.45) (* 0.5 (/ (* x y) z)) (if (<= x 1.4) (/ y (* x z)) (* 0.5 (* y (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.45) {
tmp = 0.5 * ((x * y) / z);
} else if (x <= 1.4) {
tmp = y / (x * z);
} else {
tmp = 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 (x <= (-1.45d0)) then
tmp = 0.5d0 * ((x * y) / z)
else if (x <= 1.4d0) then
tmp = y / (x * z)
else
tmp = 0.5d0 * (y * (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.45) {
tmp = 0.5 * ((x * y) / z);
} else if (x <= 1.4) {
tmp = y / (x * z);
} else {
tmp = 0.5 * (y * (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.45: tmp = 0.5 * ((x * y) / z) elif x <= 1.4: tmp = y / (x * z) else: tmp = 0.5 * (y * (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.45) tmp = Float64(0.5 * Float64(Float64(x * y) / z)); elseif (x <= 1.4) tmp = Float64(y / Float64(x * z)); else tmp = Float64(0.5 * Float64(y * Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.45) tmp = 0.5 * ((x * y) / z); elseif (x <= 1.4) tmp = y / (x * z); else tmp = 0.5 * (y * (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.45], N[(0.5 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z}\\
\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if x < -1.44999999999999996Initial program 68.0%
Taylor expanded in x around 0 38.4%
Taylor expanded in x around inf 38.4%
if -1.44999999999999996 < x < 1.3999999999999999Initial program 93.0%
associate-*r/93.0%
associate-/l/93.8%
associate-*l/93.7%
*-commutative93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in x around 0 92.8%
if 1.3999999999999999 < x Initial program 81.8%
Taylor expanded in x around 0 42.0%
Taylor expanded in x around inf 42.0%
associate-*r/50.5%
Simplified50.5%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1e-65) (not (<= y 5.5e-21))) (/ (/ y z) x) (/ (/ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e-65) || !(y <= 5.5e-21)) {
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 ((y <= (-1d-65)) .or. (.not. (y <= 5.5d-21))) 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 ((y <= -1e-65) || !(y <= 5.5e-21)) {
tmp = (y / z) / x;
} else {
tmp = (y / x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1e-65) or not (y <= 5.5e-21): tmp = (y / z) / x else: tmp = (y / x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1e-65) || !(y <= 5.5e-21)) tmp = Float64(Float64(y / z) / x); else tmp = Float64(Float64(y / x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1e-65) || ~((y <= 5.5e-21))) tmp = (y / z) / x; else tmp = (y / x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1e-65], N[Not[LessEqual[y, 5.5e-21]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-65} \lor \neg \left(y \leq 5.5 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if y < -9.99999999999999923e-66 or 5.49999999999999977e-21 < y Initial program 92.8%
associate-*r/93.6%
associate-/l/90.3%
associate-*l/90.3%
*-commutative90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in x around 0 53.0%
div-inv53.0%
associate-/r*62.8%
Applied egg-rr62.8%
if -9.99999999999999923e-66 < y < 5.49999999999999977e-21Initial program 74.9%
associate-*r/99.1%
associate-/l/83.6%
associate-*l/83.6%
*-commutative83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in x around 0 45.5%
*-commutative45.5%
associate-/r*51.8%
Simplified51.8%
Final simplification57.6%
(FPCore (x y z) :precision binary64 (if (<= z 4.2e-64) (/ (/ y x) z) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 4.2e-64) {
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 (z <= 4.2d-64) 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 (z <= 4.2e-64) {
tmp = (y / x) / z;
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 4.2e-64: tmp = (y / x) / z else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 4.2e-64) 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 (z <= 4.2e-64) tmp = (y / x) / z; else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 4.2e-64], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.2 \cdot 10^{-64}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 4.20000000000000023e-64Initial program 87.8%
associate-*r/99.9%
associate-/l/91.4%
associate-*l/91.3%
*-commutative91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in x around 0 48.7%
*-commutative48.7%
associate-/r*52.7%
Simplified52.7%
if 4.20000000000000023e-64 < z Initial program 76.2%
associate-*r/87.1%
associate-/l/76.9%
associate-*l/76.9%
*-commutative76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in x around 0 51.6%
Final simplification52.4%
(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 84.4%
associate-*r/96.2%
associate-/l/87.2%
associate-*l/87.2%
*-commutative87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in x around 0 49.5%
Final simplification49.5%
(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 2023262
(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))