
(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 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 98.6%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -4.9e-117)
1.0
(if (<= t 1.5e-303)
(+ 1.0 (/ (/ x z) y))
(if (<= t 8.4e-159) (- 1.0 (/ x (* y y))) (+ 1.0 (/ (/ x t) (- y z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.9e-117) {
tmp = 1.0;
} else if (t <= 1.5e-303) {
tmp = 1.0 + ((x / z) / y);
} else if (t <= 8.4e-159) {
tmp = 1.0 - (x / (y * 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 (t <= (-4.9d-117)) then
tmp = 1.0d0
else if (t <= 1.5d-303) then
tmp = 1.0d0 + ((x / z) / y)
else if (t <= 8.4d-159) then
tmp = 1.0d0 - (x / (y * 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 (t <= -4.9e-117) {
tmp = 1.0;
} else if (t <= 1.5e-303) {
tmp = 1.0 + ((x / z) / y);
} else if (t <= 8.4e-159) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.9e-117: tmp = 1.0 elif t <= 1.5e-303: tmp = 1.0 + ((x / z) / y) elif t <= 8.4e-159: tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.9e-117) tmp = 1.0; elseif (t <= 1.5e-303) tmp = Float64(1.0 + Float64(Float64(x / z) / y)); elseif (t <= 8.4e-159) tmp = Float64(1.0 - Float64(x / Float64(y * 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 (t <= -4.9e-117) tmp = 1.0; elseif (t <= 1.5e-303) tmp = 1.0 + ((x / z) / y); elseif (t <= 8.4e-159) tmp = 1.0 - (x / (y * y)); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.9e-117], 1.0, If[LessEqual[t, 1.5e-303], N[(1.0 + N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.4e-159], N[(1.0 - N[(x / N[(y * y), $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}\;t \leq -4.9 \cdot 10^{-117}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{-303}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y}\\
\mathbf{elif}\;t \leq 8.4 \cdot 10^{-159}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -4.8999999999999998e-117Initial program 99.1%
Taylor expanded in x around 0 89.5%
if -4.8999999999999998e-117 < t < 1.50000000000000014e-303Initial program 96.4%
Taylor expanded in z around inf 63.8%
+-commutative63.8%
associate-/r*63.7%
Simplified63.7%
Taylor expanded in y around inf 62.1%
if 1.50000000000000014e-303 < t < 8.3999999999999997e-159Initial program 99.9%
Taylor expanded in z around 0 77.3%
Taylor expanded in y around inf 81.2%
if 8.3999999999999997e-159 < t Initial program 98.9%
Taylor expanded in t around inf 95.7%
+-commutative95.7%
associate-/r*94.7%
Simplified94.7%
Final simplification85.0%
(FPCore (x y z t) :precision binary64 (if (<= t -1.45e-90) (+ 1.0 (/ (/ x z) (- y t))) (if (<= t 7e-144) (+ 1.0 (/ x (* y (- z y)))) (+ 1.0 (/ (/ x t) (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.45e-90) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 7e-144) {
tmp = 1.0 + (x / (y * (z - 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 (t <= (-1.45d-90)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 7d-144) then
tmp = 1.0d0 + (x / (y * (z - 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 (t <= -1.45e-90) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 7e-144) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.45e-90: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 7e-144: tmp = 1.0 + (x / (y * (z - y))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.45e-90) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 7e-144) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - 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 (t <= -1.45e-90) tmp = 1.0 + ((x / z) / (y - t)); elseif (t <= 7e-144) tmp = 1.0 + (x / (y * (z - y))); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.45e-90], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e-144], N[(1.0 + N[(x / N[(y * N[(z - 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}\;t \leq -1.45 \cdot 10^{-90}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-144}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -1.44999999999999992e-90Initial program 100.0%
Taylor expanded in z around inf 86.1%
+-commutative86.1%
associate-/r*86.1%
Simplified86.1%
if -1.44999999999999992e-90 < t < 6.9999999999999997e-144Initial program 96.9%
Taylor expanded in y around inf 91.9%
if 6.9999999999999997e-144 < t Initial program 98.9%
Taylor expanded in t around inf 96.7%
+-commutative96.7%
associate-/r*95.6%
Simplified95.6%
Final simplification91.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.8e-72)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 3.8e-250)
(- 1.0 (/ x (* y (- y t))))
(+ 1.0 (/ (/ x t) (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-72) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.8e-250) {
tmp = 1.0 - (x / (y * (y - t)));
} 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 <= (-1.8d-72)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 3.8d-250) then
tmp = 1.0d0 - (x / (y * (y - t)))
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 <= -1.8e-72) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.8e-250) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e-72: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 3.8e-250: tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e-72) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 3.8e-250) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); 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 <= -1.8e-72) tmp = 1.0 + ((x / z) / (y - t)); elseif (z <= 3.8e-250) tmp = 1.0 - (x / (y * (y - t))); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e-72], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e-250], N[(1.0 - N[(x / N[(y * N[(y - t), $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 -1.8 \cdot 10^{-72}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-250}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -1.8e-72Initial program 100.0%
Taylor expanded in z around inf 97.3%
+-commutative97.3%
associate-/r*97.3%
Simplified97.3%
if -1.8e-72 < z < 3.79999999999999971e-250Initial program 95.5%
Taylor expanded in z around 0 90.2%
if 3.79999999999999971e-250 < z Initial program 99.0%
Taylor expanded in t around inf 79.9%
+-commutative79.9%
associate-/r*79.8%
Simplified79.8%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (<= t 1.85e-303) (+ 1.0 (/ (/ x z) (- y t))) (if (<= t 5.5e-158) (- 1.0 (/ x (* y y))) (+ 1.0 (/ (/ x t) (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.85e-303) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 5.5e-158) {
tmp = 1.0 - (x / (y * 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 (t <= 1.85d-303) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 5.5d-158) then
tmp = 1.0d0 - (x / (y * 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 (t <= 1.85e-303) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 5.5e-158) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.85e-303: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 5.5e-158: tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.85e-303) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 5.5e-158) tmp = Float64(1.0 - Float64(x / Float64(y * 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 (t <= 1.85e-303) tmp = 1.0 + ((x / z) / (y - t)); elseif (t <= 5.5e-158) tmp = 1.0 - (x / (y * y)); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.85e-303], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e-158], N[(1.0 - N[(x / N[(y * y), $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}\;t \leq 1.85 \cdot 10^{-303}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-158}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 1.8500000000000001e-303Initial program 98.1%
Taylor expanded in z around inf 76.7%
+-commutative76.7%
associate-/r*76.6%
Simplified76.6%
if 1.8500000000000001e-303 < t < 5.50000000000000025e-158Initial program 99.9%
Taylor expanded in z around 0 77.3%
Taylor expanded in y around inf 81.2%
if 5.50000000000000025e-158 < t Initial program 98.9%
Taylor expanded in t around inf 95.7%
+-commutative95.7%
associate-/r*94.7%
Simplified94.7%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.7e-44) (- 1.0 (/ x (* y y))) (if (<= y 4.3e-162) (/ (- z (/ x t)) z) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.7e-44) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 4.3e-162) {
tmp = (z - (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-44)) then
tmp = 1.0d0 - (x / (y * y))
else if (y <= 4.3d-162) then
tmp = (z - (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-44) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 4.3e-162) {
tmp = (z - (x / t)) / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.7e-44: tmp = 1.0 - (x / (y * y)) elif y <= 4.3e-162: tmp = (z - (x / t)) / z else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.7e-44) tmp = Float64(1.0 - Float64(x / Float64(y * y))); elseif (y <= 4.3e-162) tmp = Float64(Float64(z - 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-44) tmp = 1.0 - (x / (y * y)); elseif (y <= 4.3e-162) tmp = (z - (x / t)) / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.7e-44], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.3e-162], N[(N[(z - N[(x / t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-44}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{-162}:\\
\;\;\;\;\frac{z - \frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.70000000000000008e-44Initial program 100.0%
Taylor expanded in z around 0 98.8%
Taylor expanded in y around inf 86.9%
if -1.70000000000000008e-44 < y < 4.29999999999999996e-162Initial program 95.6%
Taylor expanded in y around 0 80.8%
Taylor expanded in z around 0 79.8%
if 4.29999999999999996e-162 < y Initial program 99.9%
Taylor expanded in x around 0 85.8%
(FPCore (x y z t) :precision binary64 (if (<= y -2.05e-44) (- 1.0 (/ x (* y y))) (if (<= y 4.3e-162) (- 1.0 (/ x (* z t))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.05e-44) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 4.3e-162) {
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 <= (-2.05d-44)) then
tmp = 1.0d0 - (x / (y * y))
else if (y <= 4.3d-162) 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 <= -2.05e-44) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 4.3e-162) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.05e-44: tmp = 1.0 - (x / (y * y)) elif y <= 4.3e-162: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.05e-44) tmp = Float64(1.0 - Float64(x / Float64(y * y))); elseif (y <= 4.3e-162) 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 <= -2.05e-44) tmp = 1.0 - (x / (y * y)); elseif (y <= 4.3e-162) tmp = 1.0 - (x / (z * t)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.05e-44], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.3e-162], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-44}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{-162}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.04999999999999996e-44Initial program 100.0%
Taylor expanded in z around 0 98.8%
Taylor expanded in y around inf 86.9%
if -2.04999999999999996e-44 < y < 4.29999999999999996e-162Initial program 95.6%
Taylor expanded in y around 0 80.8%
if 4.29999999999999996e-162 < y Initial program 99.9%
Taylor expanded in x around 0 85.8%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (<= y -2.5e-50) 1.0 (if (<= y 2.7e-166) (- 1.0 (/ x (* z t))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.5e-50) {
tmp = 1.0;
} else if (y <= 2.7e-166) {
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 <= (-2.5d-50)) then
tmp = 1.0d0
else if (y <= 2.7d-166) 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 <= -2.5e-50) {
tmp = 1.0;
} else if (y <= 2.7e-166) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.5e-50: tmp = 1.0 elif y <= 2.7e-166: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.5e-50) tmp = 1.0; elseif (y <= 2.7e-166) 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 <= -2.5e-50) tmp = 1.0; elseif (y <= 2.7e-166) tmp = 1.0 - (x / (z * t)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.5e-50], 1.0, If[LessEqual[y, 2.7e-166], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-50}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-166}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.49999999999999984e-50 or 2.70000000000000006e-166 < y Initial program 100.0%
Taylor expanded in x around 0 86.2%
if -2.49999999999999984e-50 < y < 2.70000000000000006e-166Initial program 95.6%
Taylor expanded in y around 0 80.8%
Final simplification84.5%
(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 98.6%
Taylor expanded in x around 0 77.9%
herbie shell --seed 2024137
(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)))))