
(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 10 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 z) (- t y)))))
double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - z) * (t - 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 - z) * (t - y)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - z) * (t - y)));
}
def code(x, y, z, t): return 1.0 + (x / ((y - z) * (t - y)))
function code(x, y, z, t) return Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y)))) end
function tmp = code(x, y, z, t) tmp = 1.0 + (x / ((y - z) * (t - y))); end
code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}
\end{array}
Initial program 99.0%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.7e-136)
1.0
(if (<= y 1.85e-183)
(- 1.0 (/ x (* z t)))
(if (<= y 5.6e-132)
(+ 1.0 (/ x (* y t)))
(if (<= y 6.4e-62) (- 1.0 (/ (/ x t) z)) 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.7e-136) {
tmp = 1.0;
} else if (y <= 1.85e-183) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 5.6e-132) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 6.4e-62) {
tmp = 1.0 - ((x / t) / z);
} 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 <= (-1.7d-136)) then
tmp = 1.0d0
else if (y <= 1.85d-183) then
tmp = 1.0d0 - (x / (z * t))
else if (y <= 5.6d-132) then
tmp = 1.0d0 + (x / (y * t))
else if (y <= 6.4d-62) then
tmp = 1.0d0 - ((x / t) / z)
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 <= -1.7e-136) {
tmp = 1.0;
} else if (y <= 1.85e-183) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 5.6e-132) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 6.4e-62) {
tmp = 1.0 - ((x / t) / z);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.7e-136: tmp = 1.0 elif y <= 1.85e-183: tmp = 1.0 - (x / (z * t)) elif y <= 5.6e-132: tmp = 1.0 + (x / (y * t)) elif y <= 6.4e-62: tmp = 1.0 - ((x / t) / z) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.7e-136) tmp = 1.0; elseif (y <= 1.85e-183) tmp = Float64(1.0 - Float64(x / Float64(z * t))); elseif (y <= 5.6e-132) tmp = Float64(1.0 + Float64(x / Float64(y * t))); elseif (y <= 6.4e-62) tmp = Float64(1.0 - Float64(Float64(x / t) / z)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.7e-136) tmp = 1.0; elseif (y <= 1.85e-183) tmp = 1.0 - (x / (z * t)); elseif (y <= 5.6e-132) tmp = 1.0 + (x / (y * t)); elseif (y <= 6.4e-62) tmp = 1.0 - ((x / t) / z); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.7e-136], 1.0, If[LessEqual[y, 1.85e-183], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e-132], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e-62], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-136}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-183}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-132}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-62}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.7e-136 or 6.40000000000000043e-62 < y Initial program 99.9%
Taylor expanded in t around 0 88.9%
Taylor expanded in y around 0 70.2%
associate-*r/70.2%
neg-mul-170.2%
Simplified70.2%
Taylor expanded in x around 0 85.2%
if -1.7e-136 < y < 1.8499999999999999e-183Initial program 96.9%
Taylor expanded in y around 0 80.6%
if 1.8499999999999999e-183 < y < 5.60000000000000005e-132Initial program 100.0%
Taylor expanded in z around 0 64.0%
associate-/r*64.0%
Simplified64.0%
Taylor expanded in y around 0 64.0%
associate-*r/64.0%
mul-1-neg64.0%
*-commutative64.0%
Simplified64.0%
if 5.60000000000000005e-132 < y < 6.40000000000000043e-62Initial program 95.2%
Taylor expanded in y around 0 71.2%
associate-/r*76.0%
div-inv76.0%
Applied egg-rr76.0%
un-div-inv76.0%
Applied egg-rr76.0%
Final simplification82.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.32e-76) (not (<= y 1.85e-183))) (+ 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 <= -1.32e-76) || !(y <= 1.85e-183)) {
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 <= (-1.32d-76)) .or. (.not. (y <= 1.85d-183))) 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 <= -1.32e-76) || !(y <= 1.85e-183)) {
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 <= -1.32e-76) or not (y <= 1.85e-183): 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 <= -1.32e-76) || !(y <= 1.85e-183)) 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 <= -1.32e-76) || ~((y <= 1.85e-183))) 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, -1.32e-76], N[Not[LessEqual[y, 1.85e-183]], $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 -1.32 \cdot 10^{-76} \lor \neg \left(y \leq 1.85 \cdot 10^{-183}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -1.31999999999999996e-76 or 1.8499999999999999e-183 < y Initial program 99.7%
Taylor expanded in z around 0 89.9%
if -1.31999999999999996e-76 < y < 1.8499999999999999e-183Initial program 97.5%
Taylor expanded in y around 0 79.4%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.1e-37) (+ 1.0 (/ x (* y (- z y)))) (if (<= z 3.5e-16) (+ 1.0 (/ x (* y (- t y)))) (- 1.0 (/ (/ x t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e-37) {
tmp = 1.0 + (x / (y * (z - y)));
} else if (z <= 3.5e-16) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - ((x / t) / z);
}
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 <= (-1.1d-37)) then
tmp = 1.0d0 + (x / (y * (z - y)))
else if (z <= 3.5d-16) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 - ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e-37) {
tmp = 1.0 + (x / (y * (z - y)));
} else if (z <= 3.5e-16) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.1e-37: tmp = 1.0 + (x / (y * (z - y))) elif z <= 3.5e-16: tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 - ((x / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.1e-37) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); elseif (z <= 3.5e-16) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 - Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.1e-37) tmp = 1.0 + (x / (y * (z - y))); elseif (z <= 3.5e-16) tmp = 1.0 + (x / (y * (t - y))); else tmp = 1.0 - ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.1e-37], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-16], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-37}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-16}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if z < -1.10000000000000001e-37Initial program 99.4%
Taylor expanded in t around 0 83.5%
if -1.10000000000000001e-37 < z < 3.50000000000000017e-16Initial program 98.2%
Taylor expanded in z around 0 85.4%
if 3.50000000000000017e-16 < z Initial program 99.9%
Taylor expanded in y around 0 77.5%
associate-/r*76.2%
div-inv76.1%
Applied egg-rr76.1%
un-div-inv76.2%
Applied egg-rr76.2%
Final simplification82.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -6.1e-105)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 3.5e-177)
(+ 1.0 (/ x (* y (- t y))))
(+ 1.0 (/ x (* (- y z) t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.1e-105) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.5e-177) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 + (x / ((y - 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 (z <= (-6.1d-105)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 3.5d-177) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 + (x / ((y - z) * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.1e-105) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.5e-177) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.1e-105: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 3.5e-177: tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 + (x / ((y - z) * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.1e-105) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 3.5e-177) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.1e-105) tmp = 1.0 + ((x / z) / (y - t)); elseif (z <= 3.5e-177) tmp = 1.0 + (x / (y * (t - y))); else tmp = 1.0 + (x / ((y - z) * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.1e-105], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-177], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{-105}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-177}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if z < -6.09999999999999985e-105Initial program 99.5%
Taylor expanded in z around inf 92.4%
mul-1-neg92.4%
associate-/r*92.8%
distribute-neg-frac92.8%
Simplified92.8%
if -6.09999999999999985e-105 < z < 3.5000000000000002e-177Initial program 97.1%
Taylor expanded in z around 0 91.6%
if 3.5000000000000002e-177 < z Initial program 99.9%
Taylor expanded in t around inf 82.4%
associate-*r/82.4%
neg-mul-182.4%
Simplified82.4%
Final simplification88.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.4e-106)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 3.5e-177)
(+ 1.0 (/ x (* y (- t y))))
(+ 1.0 (/ (/ x t) (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.4e-106) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.5e-177) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
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 <= (-3.4d-106)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 3.5d-177) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.4e-106) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.5e-177) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.4e-106: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 3.5e-177: tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.4e-106) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 3.5e-177) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.4e-106) tmp = 1.0 + ((x / z) / (y - t)); elseif (z <= 3.5e-177) tmp = 1.0 + (x / (y * (t - y))); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.4e-106], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-177], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-106}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-177}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -3.39999999999999982e-106Initial program 99.5%
Taylor expanded in z around inf 92.4%
mul-1-neg92.4%
associate-/r*92.8%
distribute-neg-frac92.8%
Simplified92.8%
if -3.39999999999999982e-106 < z < 3.5000000000000002e-177Initial program 97.1%
Taylor expanded in z around 0 91.6%
if 3.5000000000000002e-177 < z Initial program 99.9%
associate-/r*96.2%
div-inv96.2%
Applied egg-rr96.2%
associate-*l/98.1%
un-div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in y around 0 81.5%
associate-*r/81.5%
mul-1-neg81.5%
Simplified81.5%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (<= y -3.8e-137) 1.0 (if (<= y 3.4e-158) (- 1.0 (/ x (* z t))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.8e-137) {
tmp = 1.0;
} else if (y <= 3.4e-158) {
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 <= (-3.8d-137)) then
tmp = 1.0d0
else if (y <= 3.4d-158) 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 <= -3.8e-137) {
tmp = 1.0;
} else if (y <= 3.4e-158) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.8e-137: tmp = 1.0 elif y <= 3.4e-158: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.8e-137) tmp = 1.0; elseif (y <= 3.4e-158) 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 <= -3.8e-137) tmp = 1.0; elseif (y <= 3.4e-158) tmp = 1.0 - (x / (z * t)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.8e-137], 1.0, If[LessEqual[y, 3.4e-158], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-137}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-158}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.79999999999999999e-137 or 3.3999999999999999e-158 < y Initial program 99.7%
Taylor expanded in t around 0 85.5%
Taylor expanded in y around 0 67.6%
associate-*r/67.6%
neg-mul-167.6%
Simplified67.6%
Taylor expanded in x around 0 83.0%
if -3.79999999999999999e-137 < y < 3.3999999999999999e-158Initial program 97.1%
Taylor expanded in y around 0 77.9%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (<= t 1.65e-52) (+ 1.0 (/ x (* y (- z y)))) (+ 1.0 (/ x (* (- y z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e-52) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 + (x / ((y - 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 (t <= 1.65d-52) then
tmp = 1.0d0 + (x / (y * (z - y)))
else
tmp = 1.0d0 + (x / ((y - z) * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e-52) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.65e-52: tmp = 1.0 + (x / (y * (z - y))) else: tmp = 1.0 + (x / ((y - z) * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.65e-52) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); else tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.65e-52) tmp = 1.0 + (x / (y * (z - y))); else tmp = 1.0 + (x / ((y - z) * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.65e-52], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.65 \cdot 10^{-52}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if t < 1.64999999999999998e-52Initial program 98.9%
Taylor expanded in t around 0 78.3%
if 1.64999999999999998e-52 < t Initial program 99.4%
Taylor expanded in t around inf 96.8%
associate-*r/96.8%
neg-mul-196.8%
Simplified96.8%
Final simplification83.8%
(FPCore (x y z t) :precision binary64 (if (<= t 2.8e-163) (+ 1.0 (/ x (* y z))) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.8e-163) {
tmp = 1.0 + (x / (y * z));
} 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 (t <= 2.8d-163) then
tmp = 1.0d0 + (x / (y * z))
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 (t <= 2.8e-163) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.8e-163: tmp = 1.0 + (x / (y * z)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.8e-163) tmp = Float64(1.0 + Float64(x / Float64(y * z))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.8e-163) tmp = 1.0 + (x / (y * z)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.8e-163], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.8 \cdot 10^{-163}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < 2.8e-163Initial program 98.7%
Taylor expanded in t around 0 78.5%
Taylor expanded in y around 0 65.6%
associate-*r/65.6%
neg-mul-165.6%
Simplified65.6%
Taylor expanded in x around 0 65.6%
if 2.8e-163 < t Initial program 99.5%
Taylor expanded in t around 0 63.1%
Taylor expanded in y around 0 51.8%
associate-*r/51.8%
neg-mul-151.8%
Simplified51.8%
Taylor expanded in x around 0 76.9%
Final simplification70.1%
(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.0%
Taylor expanded in t around 0 72.4%
Taylor expanded in y around 0 60.2%
associate-*r/60.2%
neg-mul-160.2%
Simplified60.2%
Taylor expanded in x around 0 72.0%
Final simplification72.0%
herbie shell --seed 2024077
(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)))))