
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z): return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function tmp = code(x, y, z) tmp = (x * y) / ((z * z) * (z + 1.0)); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z): return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function tmp = code(x, y, z) tmp = (x * y) / ((z * z) * (z + 1.0)); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}
(FPCore (x y z) :precision binary64 (/ (* (/ y z) (/ x z)) (+ z 1.0)))
double code(double x, double y, double z) {
return ((y / z) * (x / z)) / (z + 1.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((y / z) * (x / z)) / (z + 1.0d0)
end function
public static double code(double x, double y, double z) {
return ((y / z) * (x / z)) / (z + 1.0);
}
def code(x, y, z): return ((y / z) * (x / z)) / (z + 1.0)
function code(x, y, z) return Float64(Float64(Float64(y / z) * Float64(x / z)) / Float64(z + 1.0)) end
function tmp = code(x, y, z) tmp = ((y / z) * (x / z)) / (z + 1.0); end
code[x_, y_, z_] := N[(N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{z} \cdot \frac{x}{z}}{z + 1}
\end{array}
Initial program 85.8%
associate-/r*86.9%
Simplified86.9%
*-commutative86.9%
times-frac97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (+ z 1.0) (* z z))))
(if (or (<= t_0 -20000000.0) (not (<= t_0 5e-117)))
(/ (* y x) t_0)
(/ (/ x z) (/ z y)))))
double code(double x, double y, double z) {
double t_0 = (z + 1.0) * (z * z);
double tmp;
if ((t_0 <= -20000000.0) || !(t_0 <= 5e-117)) {
tmp = (y * x) / t_0;
} else {
tmp = (x / z) / (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) :: t_0
real(8) :: tmp
t_0 = (z + 1.0d0) * (z * z)
if ((t_0 <= (-20000000.0d0)) .or. (.not. (t_0 <= 5d-117))) then
tmp = (y * x) / t_0
else
tmp = (x / z) / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z + 1.0) * (z * z);
double tmp;
if ((t_0 <= -20000000.0) || !(t_0 <= 5e-117)) {
tmp = (y * x) / t_0;
} else {
tmp = (x / z) / (z / y);
}
return tmp;
}
def code(x, y, z): t_0 = (z + 1.0) * (z * z) tmp = 0 if (t_0 <= -20000000.0) or not (t_0 <= 5e-117): tmp = (y * x) / t_0 else: tmp = (x / z) / (z / y) return tmp
function code(x, y, z) t_0 = Float64(Float64(z + 1.0) * Float64(z * z)) tmp = 0.0 if ((t_0 <= -20000000.0) || !(t_0 <= 5e-117)) tmp = Float64(Float64(y * x) / t_0); else tmp = Float64(Float64(x / z) / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z + 1.0) * (z * z); tmp = 0.0; if ((t_0 <= -20000000.0) || ~((t_0 <= 5e-117))) tmp = (y * x) / t_0; else tmp = (x / z) / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -20000000.0], N[Not[LessEqual[t$95$0, 5e-117]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
\mathbf{if}\;t_0 \leq -20000000 \lor \neg \left(t_0 \leq 5 \cdot 10^{-117}\right):\\
\;\;\;\;\frac{y \cdot x}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z}{y}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 z z) (+.f64 z 1)) < -2e7 or 5e-117 < (*.f64 (*.f64 z z) (+.f64 z 1)) Initial program 89.7%
if -2e7 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 5e-117Initial program 80.3%
associate-*l*80.3%
times-frac99.8%
*-commutative99.8%
associate-/r/90.5%
*-commutative90.5%
distribute-lft1-in90.5%
fma-def90.5%
Simplified90.5%
Taylor expanded in z around 0 82.1%
unpow282.1%
associate-*r/90.4%
Simplified90.4%
associate-/l/97.9%
un-div-inv97.9%
clear-num97.9%
div-inv97.8%
associate-*r/89.7%
Applied egg-rr89.7%
*-commutative89.7%
associate-/l*97.8%
associate-*l/99.9%
div-inv99.9%
Applied egg-rr99.9%
Final simplification93.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (+ z 1.0) (* z z))))
(if (<= t_0 -20000000.0)
(/ (* y (/ x (* z z))) (+ z 1.0))
(if (<= t_0 5e-117) (/ (/ x z) (/ z y)) (/ (* y x) t_0)))))
double code(double x, double y, double z) {
double t_0 = (z + 1.0) * (z * z);
double tmp;
if (t_0 <= -20000000.0) {
tmp = (y * (x / (z * z))) / (z + 1.0);
} else if (t_0 <= 5e-117) {
tmp = (x / z) / (z / y);
} else {
tmp = (y * x) / 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 = (z + 1.0d0) * (z * z)
if (t_0 <= (-20000000.0d0)) then
tmp = (y * (x / (z * z))) / (z + 1.0d0)
else if (t_0 <= 5d-117) then
tmp = (x / z) / (z / y)
else
tmp = (y * x) / t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z + 1.0) * (z * z);
double tmp;
if (t_0 <= -20000000.0) {
tmp = (y * (x / (z * z))) / (z + 1.0);
} else if (t_0 <= 5e-117) {
tmp = (x / z) / (z / y);
} else {
tmp = (y * x) / t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z + 1.0) * (z * z) tmp = 0 if t_0 <= -20000000.0: tmp = (y * (x / (z * z))) / (z + 1.0) elif t_0 <= 5e-117: tmp = (x / z) / (z / y) else: tmp = (y * x) / t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z + 1.0) * Float64(z * z)) tmp = 0.0 if (t_0 <= -20000000.0) tmp = Float64(Float64(y * Float64(x / Float64(z * z))) / Float64(z + 1.0)); elseif (t_0 <= 5e-117) tmp = Float64(Float64(x / z) / Float64(z / y)); else tmp = Float64(Float64(y * x) / t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z + 1.0) * (z * z); tmp = 0.0; if (t_0 <= -20000000.0) tmp = (y * (x / (z * z))) / (z + 1.0); elseif (t_0 <= 5e-117) tmp = (x / z) / (z / y); else tmp = (y * x) / t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -20000000.0], N[(N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-117], N[(N[(x / z), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
\mathbf{if}\;t_0 \leq -20000000:\\
\;\;\;\;\frac{y \cdot \frac{x}{z \cdot z}}{z + 1}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-117}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{t_0}\\
\end{array}
\end{array}
if (*.f64 (*.f64 z z) (+.f64 z 1)) < -2e7Initial program 84.0%
associate-/r*85.9%
Simplified85.9%
associate-*l/94.7%
Applied egg-rr94.7%
if -2e7 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 5e-117Initial program 80.3%
associate-*l*80.3%
times-frac99.8%
*-commutative99.8%
associate-/r/90.5%
*-commutative90.5%
distribute-lft1-in90.5%
fma-def90.5%
Simplified90.5%
Taylor expanded in z around 0 82.1%
unpow282.1%
associate-*r/90.4%
Simplified90.4%
associate-/l/97.9%
un-div-inv97.9%
clear-num97.9%
div-inv97.8%
associate-*r/89.7%
Applied egg-rr89.7%
*-commutative89.7%
associate-/l*97.8%
associate-*l/99.9%
div-inv99.9%
Applied egg-rr99.9%
if 5e-117 < (*.f64 (*.f64 z z) (+.f64 z 1)) Initial program 93.8%
Final simplification96.5%
(FPCore (x y z) :precision binary64 (if (<= (* y x) -1e-9) (/ (- x) (* (* z z) (/ -1.0 y))) (/ (/ x z) (/ z y))))
double code(double x, double y, double z) {
double tmp;
if ((y * x) <= -1e-9) {
tmp = -x / ((z * z) * (-1.0 / y));
} else {
tmp = (x / z) / (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 * x) <= (-1d-9)) then
tmp = -x / ((z * z) * ((-1.0d0) / y))
else
tmp = (x / z) / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y * x) <= -1e-9) {
tmp = -x / ((z * z) * (-1.0 / y));
} else {
tmp = (x / z) / (z / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y * x) <= -1e-9: tmp = -x / ((z * z) * (-1.0 / y)) else: tmp = (x / z) / (z / y) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(y * x) <= -1e-9) tmp = Float64(Float64(-x) / Float64(Float64(z * z) * Float64(-1.0 / y))); else tmp = Float64(Float64(x / z) / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y * x) <= -1e-9) tmp = -x / ((z * z) * (-1.0 / y)); else tmp = (x / z) / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(y * x), $MachinePrecision], -1e-9], N[((-x) / N[(N[(z * z), $MachinePrecision] * N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -1 \cdot 10^{-9}:\\
\;\;\;\;\frac{-x}{\left(z \cdot z\right) \cdot \frac{-1}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000006e-9Initial program 87.1%
associate-*l*87.1%
times-frac92.1%
*-commutative92.1%
associate-/r/91.6%
*-commutative91.6%
distribute-lft1-in91.6%
fma-def91.6%
Simplified91.6%
Taylor expanded in z around 0 63.2%
unpow263.2%
associate-*r/53.5%
Simplified53.5%
associate-/l/49.8%
un-div-inv48.6%
clear-num48.6%
div-inv48.5%
associate-*r/51.1%
Applied egg-rr51.1%
*-commutative51.1%
associate-/l*52.1%
associate-*l/49.5%
div-inv49.5%
frac-2neg49.5%
div-inv49.5%
associate-/l*64.4%
neg-mul-164.4%
metadata-eval64.4%
associate-/r*64.4%
metadata-eval64.4%
metadata-eval64.4%
Applied egg-rr64.4%
clear-num64.4%
associate-/l/64.4%
associate-/r*64.4%
associate-/r/64.4%
metadata-eval64.4%
div-inv64.4%
times-frac68.3%
associate-/r/68.3%
/-rgt-identity68.3%
Applied egg-rr68.3%
if -1.00000000000000006e-9 < (*.f64 x y) Initial program 85.3%
associate-*l*85.3%
times-frac97.9%
*-commutative97.9%
associate-/r/92.1%
*-commutative92.1%
distribute-lft1-in92.1%
fma-def92.1%
Simplified92.1%
Taylor expanded in z around 0 75.5%
unpow275.5%
associate-*r/80.0%
Simplified80.0%
associate-/l/83.8%
un-div-inv83.8%
clear-num83.8%
div-inv83.8%
associate-*r/78.6%
Applied egg-rr78.6%
*-commutative78.6%
associate-/l*83.6%
associate-*l/85.3%
div-inv85.3%
Applied egg-rr85.3%
Final simplification80.7%
(FPCore (x y z) :precision binary64 (if (<= (* y x) -2e-14) (* x (/ y (* z z))) (* (/ y z) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y * x) <= -2e-14) {
tmp = x * (y / (z * z));
} else {
tmp = (y / z) * (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 * x) <= (-2d-14)) then
tmp = x * (y / (z * z))
else
tmp = (y / z) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y * x) <= -2e-14) {
tmp = x * (y / (z * z));
} else {
tmp = (y / z) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y * x) <= -2e-14: tmp = x * (y / (z * z)) else: tmp = (y / z) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(y * x) <= -2e-14) tmp = Float64(x * Float64(y / Float64(z * z))); else tmp = Float64(Float64(y / z) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y * x) <= -2e-14) tmp = x * (y / (z * z)); else tmp = (y / z) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(y * x), $MachinePrecision], -2e-14], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -2 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \frac{y}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (*.f64 x y) < -2e-14Initial program 87.3%
associate-*r/90.2%
associate-*l*90.2%
associate-/r*93.0%
*-commutative93.0%
distribute-lft1-in93.0%
fma-def93.0%
Simplified93.0%
Taylor expanded in z around 0 68.9%
unpow268.9%
Simplified68.9%
if -2e-14 < (*.f64 x y) Initial program 85.2%
associate-*l*85.2%
times-frac97.9%
*-commutative97.9%
associate-/r/92.0%
*-commutative92.0%
distribute-lft1-in92.0%
fma-def92.0%
Simplified92.0%
Taylor expanded in z around 0 75.4%
unpow275.4%
associate-*r/79.9%
Simplified79.9%
associate-*r/75.4%
associate-/l*73.6%
frac-times85.2%
Applied egg-rr85.2%
Final simplification80.7%
(FPCore (x y z) :precision binary64 (if (<= (* y x) -1e-9) (* x (/ y (* z z))) (/ (/ x z) (/ z y))))
double code(double x, double y, double z) {
double tmp;
if ((y * x) <= -1e-9) {
tmp = x * (y / (z * z));
} else {
tmp = (x / z) / (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 * x) <= (-1d-9)) then
tmp = x * (y / (z * z))
else
tmp = (x / z) / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y * x) <= -1e-9) {
tmp = x * (y / (z * z));
} else {
tmp = (x / z) / (z / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y * x) <= -1e-9: tmp = x * (y / (z * z)) else: tmp = (x / z) / (z / y) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(y * x) <= -1e-9) tmp = Float64(x * Float64(y / Float64(z * z))); else tmp = Float64(Float64(x / z) / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y * x) <= -1e-9) tmp = x * (y / (z * z)); else tmp = (x / z) / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(y * x), $MachinePrecision], -1e-9], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -1 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \frac{y}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000006e-9Initial program 87.1%
associate-*r/90.0%
associate-*l*90.0%
associate-/r*92.9%
*-commutative92.9%
distribute-lft1-in92.9%
fma-def92.9%
Simplified92.9%
Taylor expanded in z around 0 68.5%
unpow268.5%
Simplified68.5%
if -1.00000000000000006e-9 < (*.f64 x y) Initial program 85.3%
associate-*l*85.3%
times-frac97.9%
*-commutative97.9%
associate-/r/92.1%
*-commutative92.1%
distribute-lft1-in92.1%
fma-def92.1%
Simplified92.1%
Taylor expanded in z around 0 75.5%
unpow275.5%
associate-*r/80.0%
Simplified80.0%
associate-/l/83.8%
un-div-inv83.8%
clear-num83.8%
div-inv83.8%
associate-*r/78.6%
Applied egg-rr78.6%
*-commutative78.6%
associate-/l*83.6%
associate-*l/85.3%
div-inv85.3%
Applied egg-rr85.3%
Final simplification80.7%
(FPCore (x y z) :precision binary64 (* x (/ y (* z z))))
double code(double x, double y, double z) {
return x * (y / (z * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * (y / (z * z))
end function
public static double code(double x, double y, double z) {
return x * (y / (z * z));
}
def code(x, y, z): return x * (y / (z * z))
function code(x, y, z) return Float64(x * Float64(y / Float64(z * z))) end
function tmp = code(x, y, z) tmp = x * (y / (z * z)); end
code[x_, y_, z_] := N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y}{z \cdot z}
\end{array}
Initial program 85.8%
associate-*r/87.8%
associate-*l*87.8%
associate-/r*94.0%
*-commutative94.0%
distribute-lft1-in94.0%
fma-def94.0%
Simplified94.0%
Taylor expanded in z around 0 74.3%
unpow274.3%
Simplified74.3%
Final simplification74.3%
(FPCore (x y z) :precision binary64 (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z)))
double code(double x, double y, double z) {
double tmp;
if (z < 249.6182814532307) {
tmp = (y * (x / z)) / (z + (z * z));
} else {
tmp = (((y / z) / (1.0 + z)) * 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 < 249.6182814532307d0) then
tmp = (y * (x / z)) / (z + (z * z))
else
tmp = (((y / z) / (1.0d0 + z)) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z < 249.6182814532307) {
tmp = (y * (x / z)) / (z + (z * z));
} else {
tmp = (((y / z) / (1.0 + z)) * x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z < 249.6182814532307: tmp = (y * (x / z)) / (z + (z * z)) else: tmp = (((y / z) / (1.0 + z)) * x) / z return tmp
function code(x, y, z) tmp = 0.0 if (z < 249.6182814532307) tmp = Float64(Float64(y * Float64(x / z)) / Float64(z + Float64(z * z))); else tmp = Float64(Float64(Float64(Float64(y / z) / Float64(1.0 + z)) * x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z < 249.6182814532307) tmp = (y * (x / z)) / (z + (z * z)); else tmp = (((y / z) / (1.0 + z)) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[z, 249.6182814532307], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / N[(z + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / z), $MachinePrecision] / N[(1.0 + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < 249.6182814532307:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\
\end{array}
\end{array}
herbie shell --seed 2023297
(FPCore (x y z)
:name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))
(/ (* x y) (* (* z z) (+ z 1.0))))