
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ x (* (- y t) (- z y)))))
double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - t) * (z - y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 + (x / ((y - t) * (z - y)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - t) * (z - y)));
}
def code(x, y, z, t): return 1.0 + (x / ((y - t) * (z - y)))
function code(x, y, z, t) return Float64(1.0 + Float64(x / Float64(Float64(y - t) * Float64(z - y)))) end
function tmp = code(x, y, z, t) tmp = 1.0 + (x / ((y - t) * (z - y))); end
code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(N[(y - t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{x}{\left(y - t\right) \cdot \left(z - y\right)}
\end{array}
Initial program 99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.5e-29) (not (<= y 8.5e-125))) (+ 1.0 (/ x (* y (- t y)))) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e-29) || !(y <= 8.5e-125)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-9.5d-29)) .or. (.not. (y <= 8.5d-125))) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 - (x / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e-29) || !(y <= 8.5e-125)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.5e-29) or not (y <= 8.5e-125): tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.5e-29) || !(y <= 8.5e-125)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 - Float64(x / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9.5e-29) || ~((y <= 8.5e-125))) tmp = 1.0 + (x / (y * (t - y))); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.5e-29], N[Not[LessEqual[y, 8.5e-125]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-29} \lor \neg \left(y \leq 8.5 \cdot 10^{-125}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -9.50000000000000023e-29 or 8.5000000000000002e-125 < y Initial program 100.0%
Taylor expanded in z around 0 91.0%
if -9.50000000000000023e-29 < y < 8.5000000000000002e-125Initial program 98.0%
Taylor expanded in y around 0 82.9%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.5e-144) (not (<= y 2.4e-62))) (+ 1.0 (/ x (* y (- z y)))) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.5e-144) || !(y <= 2.4e-62)) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-2.5d-144)) .or. (.not. (y <= 2.4d-62))) then
tmp = 1.0d0 + (x / (y * (z - y)))
else
tmp = 1.0d0 - (x / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.5e-144) || !(y <= 2.4e-62)) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.5e-144) or not (y <= 2.4e-62): tmp = 1.0 + (x / (y * (z - y))) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.5e-144) || !(y <= 2.4e-62)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); else tmp = Float64(1.0 - Float64(x / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.5e-144) || ~((y <= 2.4e-62))) tmp = 1.0 + (x / (y * (z - y))); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.5e-144], N[Not[LessEqual[y, 2.4e-62]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-144} \lor \neg \left(y \leq 2.4 \cdot 10^{-62}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -2.4999999999999999e-144 or 2.39999999999999984e-62 < y Initial program 100.0%
clear-num100.0%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 92.9%
if -2.4999999999999999e-144 < y < 2.39999999999999984e-62Initial program 97.9%
Taylor expanded in y around 0 84.0%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.4e-102) (not (<= y 8.5e-63))) (+ 1.0 (/ x (* y (- z y)))) (- 1.0 (/ x (* t (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.4e-102) || !(y <= 8.5e-63)) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.4d-102)) .or. (.not. (y <= 8.5d-63))) then
tmp = 1.0d0 + (x / (y * (z - y)))
else
tmp = 1.0d0 - (x / (t * (z - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.4e-102) || !(y <= 8.5e-63)) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.4e-102) or not (y <= 8.5e-63): tmp = 1.0 + (x / (y * (z - y))) else: tmp = 1.0 - (x / (t * (z - y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.4e-102) || !(y <= 8.5e-63)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); else tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.4e-102) || ~((y <= 8.5e-63))) tmp = 1.0 + (x / (y * (z - y))); else tmp = 1.0 - (x / (t * (z - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.4e-102], N[Not[LessEqual[y, 8.5e-63]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-102} \lor \neg \left(y \leq 8.5 \cdot 10^{-63}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if y < -1.40000000000000006e-102 or 8.49999999999999969e-63 < y Initial program 100.0%
clear-num100.0%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 93.4%
if -1.40000000000000006e-102 < y < 8.49999999999999969e-63Initial program 98.0%
Taylor expanded in t around inf 87.9%
associate-*r/87.9%
neg-mul-187.9%
Simplified87.9%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (<= z -5.1e-25) (+ 1.0 (/ x (* z (- y t)))) (if (<= z 9e-192) (+ 1.0 (/ x (* y (- t y)))) (- 1.0 (/ x (* t (- z y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.1e-25) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 9e-192) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5.1d-25)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 9d-192) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 - (x / (t * (z - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.1e-25) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 9e-192) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.1e-25: tmp = 1.0 + (x / (z * (y - t))) elif z <= 9e-192: tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 - (x / (t * (z - y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.1e-25) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 9e-192) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.1e-25) tmp = 1.0 + (x / (z * (y - t))); elseif (z <= 9e-192) tmp = 1.0 + (x / (y * (t - y))); else tmp = 1.0 - (x / (t * (z - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.1e-25], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e-192], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{-25}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-192}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if z < -5.1000000000000003e-25Initial program 100.0%
Taylor expanded in z around inf 95.4%
associate-*r/95.4%
neg-mul-195.4%
*-commutative95.4%
Simplified95.4%
if -5.1000000000000003e-25 < z < 9.00000000000000048e-192Initial program 97.3%
Taylor expanded in z around 0 90.4%
if 9.00000000000000048e-192 < z Initial program 100.0%
Taylor expanded in t around inf 82.8%
associate-*r/82.8%
neg-mul-182.8%
Simplified82.8%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (<= y -8.1e-144) 1.0 (if (<= y 1.1e-61) (- 1.0 (/ x (* z t))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.1e-144) {
tmp = 1.0;
} else if (y <= 1.1e-61) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-8.1d-144)) then
tmp = 1.0d0
else if (y <= 1.1d-61) then
tmp = 1.0d0 - (x / (z * t))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.1e-144) {
tmp = 1.0;
} else if (y <= 1.1e-61) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.1e-144: tmp = 1.0 elif y <= 1.1e-61: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.1e-144) tmp = 1.0; elseif (y <= 1.1e-61) tmp = Float64(1.0 - Float64(x / Float64(z * t))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.1e-144) tmp = 1.0; elseif (y <= 1.1e-61) tmp = 1.0 - (x / (z * t)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.1e-144], 1.0, If[LessEqual[y, 1.1e-61], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.1 \cdot 10^{-144}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-61}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -8.0999999999999998e-144 or 1.10000000000000004e-61 < y Initial program 100.0%
Taylor expanded in t around inf 79.0%
associate-*r/79.0%
neg-mul-179.0%
Simplified79.0%
Taylor expanded in y around inf 69.2%
div-inv69.2%
add-sqr-sqrt34.7%
sqrt-unprod60.2%
sqr-neg60.2%
sqrt-unprod34.0%
add-sqr-sqrt65.9%
*-commutative65.9%
Applied egg-rr65.9%
associate-*r/65.9%
*-rgt-identity65.9%
associate-/l/65.8%
Simplified65.8%
Taylor expanded in x around 0 88.7%
if -8.0999999999999998e-144 < y < 1.10000000000000004e-61Initial program 97.9%
Taylor expanded in y around 0 84.0%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (<= z -2.8e-122) 1.0 (+ 1.0 (/ (/ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e-122) {
tmp = 1.0;
} else {
tmp = 1.0 + ((x / y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.8d-122)) then
tmp = 1.0d0
else
tmp = 1.0d0 + ((x / y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e-122) {
tmp = 1.0;
} else {
tmp = 1.0 + ((x / y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e-122: tmp = 1.0 else: tmp = 1.0 + ((x / y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e-122) tmp = 1.0; else tmp = Float64(1.0 + Float64(Float64(x / y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e-122) tmp = 1.0; else tmp = 1.0 + ((x / y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e-122], 1.0, N[(1.0 + N[(N[(x / y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-122}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{t}\\
\end{array}
\end{array}
if z < -2.7999999999999999e-122Initial program 100.0%
Taylor expanded in t around inf 82.8%
associate-*r/82.8%
neg-mul-182.8%
Simplified82.8%
Taylor expanded in y around inf 57.4%
div-inv57.4%
add-sqr-sqrt41.6%
sqrt-unprod54.2%
sqr-neg54.2%
sqrt-unprod16.0%
add-sqr-sqrt57.1%
*-commutative57.1%
Applied egg-rr57.1%
associate-*r/57.1%
*-rgt-identity57.1%
associate-/l/57.1%
Simplified57.1%
Taylor expanded in x around 0 86.8%
if -2.7999999999999999e-122 < z Initial program 98.9%
Taylor expanded in t around inf 82.3%
associate-*r/82.3%
neg-mul-182.3%
Simplified82.3%
Taylor expanded in y around inf 60.4%
div-inv60.4%
add-sqr-sqrt26.8%
sqrt-unprod51.5%
sqr-neg51.5%
sqrt-unprod31.3%
add-sqr-sqrt51.4%
*-commutative51.4%
Applied egg-rr51.4%
associate-*r/51.4%
*-rgt-identity51.4%
associate-/l/51.4%
Simplified51.4%
sub-neg51.4%
distribute-neg-frac51.4%
distribute-neg-frac251.4%
associate-/r*51.4%
associate-/l/51.4%
add-sqr-sqrt30.4%
sqrt-unprod53.5%
sqr-neg53.5%
sqrt-unprod27.1%
add-sqr-sqrt60.9%
associate-/r*60.4%
Applied egg-rr60.4%
associate-/r*60.9%
Simplified60.9%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (<= z -7e-125) 1.0 (+ 1.0 (/ x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e-125) {
tmp = 1.0;
} else {
tmp = 1.0 + (x / (y * t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-7d-125)) then
tmp = 1.0d0
else
tmp = 1.0d0 + (x / (y * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e-125) {
tmp = 1.0;
} else {
tmp = 1.0 + (x / (y * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e-125: tmp = 1.0 else: tmp = 1.0 + (x / (y * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e-125) tmp = 1.0; else tmp = Float64(1.0 + Float64(x / Float64(y * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7e-125) tmp = 1.0; else tmp = 1.0 + (x / (y * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e-125], 1.0, N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-125}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\end{array}
\end{array}
if z < -6.99999999999999995e-125Initial program 100.0%
Taylor expanded in t around inf 82.8%
associate-*r/82.8%
neg-mul-182.8%
Simplified82.8%
Taylor expanded in y around inf 57.4%
div-inv57.4%
add-sqr-sqrt41.6%
sqrt-unprod54.2%
sqr-neg54.2%
sqrt-unprod16.0%
add-sqr-sqrt57.1%
*-commutative57.1%
Applied egg-rr57.1%
associate-*r/57.1%
*-rgt-identity57.1%
associate-/l/57.1%
Simplified57.1%
Taylor expanded in x around 0 86.8%
if -6.99999999999999995e-125 < z Initial program 98.9%
Taylor expanded in t around inf 82.3%
associate-*r/82.3%
neg-mul-182.3%
Simplified82.3%
Taylor expanded in y around inf 60.4%
div-inv60.4%
add-sqr-sqrt26.8%
sqrt-unprod51.5%
sqr-neg51.5%
sqrt-unprod31.3%
add-sqr-sqrt51.4%
*-commutative51.4%
Applied egg-rr51.4%
associate-*r/51.4%
*-rgt-identity51.4%
associate-/l/51.4%
Simplified51.4%
sub-neg51.4%
distribute-neg-frac51.4%
distribute-neg-frac251.4%
associate-/r*51.4%
associate-/l/51.4%
+-commutative51.4%
add-sqr-sqrt30.4%
sqrt-unprod53.5%
sqr-neg53.5%
sqrt-unprod27.1%
add-sqr-sqrt60.9%
associate-/r*60.4%
Applied egg-rr60.4%
Final simplification68.6%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.3%
Taylor expanded in t around inf 82.5%
associate-*r/82.5%
neg-mul-182.5%
Simplified82.5%
Taylor expanded in y around inf 59.5%
div-inv59.5%
add-sqr-sqrt31.4%
sqrt-unprod52.3%
sqr-neg52.3%
sqrt-unprod26.5%
add-sqr-sqrt53.2%
*-commutative53.2%
Applied egg-rr53.2%
associate-*r/53.2%
*-rgt-identity53.2%
associate-/l/53.1%
Simplified53.1%
Taylor expanded in x around 0 77.5%
Final simplification77.5%
herbie shell --seed 2024066
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
:precision binary64
(- 1.0 (/ x (* (- y z) (- y t)))))