
(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 12 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 (pow (* (- y t) (/ (- y z) x)) -1.0)))
double code(double x, double y, double z, double t) {
return 1.0 - pow(((y - t) * ((y - z) / x)), -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 - (((y - t) * ((y - z) / x)) ** (-1.0d0))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.pow(((y - t) * ((y - z) / x)), -1.0);
}
def code(x, y, z, t): return 1.0 - math.pow(((y - t) * ((y - z) / x)), -1.0)
function code(x, y, z, t) return Float64(1.0 - (Float64(Float64(y - t) * Float64(Float64(y - z) / x)) ^ -1.0)) end
function tmp = code(x, y, z, t) tmp = 1.0 - (((y - t) * ((y - z) / x)) ^ -1.0); end
code[x_, y_, z_, t_] := N[(1.0 - N[Power[N[(N[(y - t), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - {\left(\left(y - t\right) \cdot \frac{y - z}{x}\right)}^{-1}
\end{array}
Initial program 98.1%
clear-num98.0%
inv-pow98.0%
*-commutative98.0%
associate-/l*98.7%
Applied egg-rr98.7%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.35e-206)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 1.5e-303)
(+ 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 <= -2.35e-206) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.5e-303) {
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 <= (-2.35d-206)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 1.5d-303) 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 <= -2.35e-206) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.5e-303) {
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 <= -2.35e-206: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 1.5e-303: 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 <= -2.35e-206) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 1.5e-303) 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 <= -2.35e-206) tmp = 1.0 + ((x / z) / (y - t)); elseif (z <= 1.5e-303) 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, -2.35e-206], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-303], 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 -2.35 \cdot 10^{-206}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-303}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -2.3499999999999999e-206Initial program 99.9%
Taylor expanded in z around inf 91.6%
+-commutative91.6%
associate-/r*88.4%
Simplified88.4%
if -2.3499999999999999e-206 < z < 1.50000000000000014e-303Initial program 89.6%
Taylor expanded in z around 0 89.6%
if 1.50000000000000014e-303 < z Initial program 97.5%
Taylor expanded in t around inf 81.9%
+-commutative81.9%
associate-/r*82.8%
Simplified82.8%
Final simplification85.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.35e-206)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 1.5e-303)
(+ 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 <= -2.35e-206) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.5e-303) {
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 <= (-2.35d-206)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 1.5d-303) 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 <= -2.35e-206) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.5e-303) {
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 <= -2.35e-206: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 1.5e-303: 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 <= -2.35e-206) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 1.5e-303) tmp = Float64(1.0 + Float64(Float64(x / 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 <= -2.35e-206) tmp = 1.0 + ((x / z) / (y - t)); elseif (z <= 1.5e-303) 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, -2.35e-206], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-303], N[(1.0 + N[(N[(x / y), $MachinePrecision] / N[(t - 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}\;z \leq -2.35 \cdot 10^{-206}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-303}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{t - y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -2.3499999999999999e-206Initial program 99.9%
Taylor expanded in z around inf 91.6%
+-commutative91.6%
associate-/r*88.4%
Simplified88.4%
if -2.3499999999999999e-206 < z < 1.50000000000000014e-303Initial program 89.6%
clear-num89.5%
inv-pow89.5%
*-commutative89.5%
associate-/l*99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 89.6%
associate-/r*99.7%
Simplified99.7%
if 1.50000000000000014e-303 < z Initial program 97.5%
Taylor expanded in t around inf 81.9%
+-commutative81.9%
associate-/r*82.8%
Simplified82.8%
Final simplification86.5%
(FPCore (x y z t) :precision binary64 (if (<= y -3.1e-114) 1.0 (if (<= y 2e-162) (- 1.0 (/ x (* t z))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.1e-114) {
tmp = 1.0;
} else if (y <= 2e-162) {
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 <= (-3.1d-114)) then
tmp = 1.0d0
else if (y <= 2d-162) 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 <= -3.1e-114) {
tmp = 1.0;
} else if (y <= 2e-162) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.1e-114: tmp = 1.0 elif y <= 2e-162: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.1e-114) tmp = 1.0; elseif (y <= 2e-162) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.1e-114) tmp = 1.0; elseif (y <= 2e-162) tmp = 1.0 - (x / (t * z)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.1e-114], 1.0, If[LessEqual[y, 2e-162], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-114}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-162}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.1e-114 or 1.99999999999999991e-162 < y Initial program 99.9%
Taylor expanded in x around 0 86.5%
if -3.1e-114 < y < 1.99999999999999991e-162Initial program 93.7%
Taylor expanded in y around 0 77.7%
Final simplification83.8%
(FPCore (x y z t) :precision binary64 (if (<= t 1.4e-168) (+ 1.0 (/ (/ x y) z)) (+ 1.0 (/ (/ x t) (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.4e-168) {
tmp = 1.0 + ((x / y) / z);
} 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.4d-168) then
tmp = 1.0d0 + ((x / y) / z)
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.4e-168) {
tmp = 1.0 + ((x / y) / z);
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.4e-168: tmp = 1.0 + ((x / y) / z) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.4e-168) tmp = Float64(1.0 + Float64(Float64(x / y) / z)); 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.4e-168) tmp = 1.0 + ((x / y) / z); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.4e-168], N[(1.0 + N[(N[(x / y), $MachinePrecision] / z), $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.4 \cdot 10^{-168}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 1.4000000000000001e-168Initial program 97.4%
Taylor expanded in t around 0 73.6%
*-commutative73.6%
associate-/r*74.1%
Simplified74.1%
Taylor expanded in z around inf 60.5%
associate-/r*59.8%
Simplified59.8%
if 1.4000000000000001e-168 < t Initial program 99.0%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
associate-/r*90.6%
Simplified90.6%
Final simplification72.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.25e-158) (+ 1.0 (/ (/ x z) (- y t))) (+ 1.0 (/ (/ x t) (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-158) {
tmp = 1.0 + ((x / z) / (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.25d-158)) then
tmp = 1.0d0 + ((x / z) / (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.25e-158) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.25e-158: tmp = 1.0 + ((x / z) / (y - t)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.25e-158) tmp = Float64(1.0 + Float64(Float64(x / z) / 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.25e-158) tmp = 1.0 + ((x / z) / (y - t)); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.25e-158], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $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.25 \cdot 10^{-158}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -1.24999999999999993e-158Initial program 100.0%
Taylor expanded in z around inf 93.9%
+-commutative93.9%
associate-/r*92.1%
Simplified92.1%
if -1.24999999999999993e-158 < z Initial program 96.7%
Taylor expanded in t around inf 79.9%
+-commutative79.9%
associate-/r*81.3%
Simplified81.3%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (<= t 1.6e-168) (+ 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.6e-168) {
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.6d-168) 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.6e-168) {
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.6e-168: 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.6e-168) 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.6e-168) 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.6e-168], 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.6 \cdot 10^{-168}:\\
\;\;\;\;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.60000000000000003e-168Initial program 97.4%
Taylor expanded in t around 0 73.6%
if 1.60000000000000003e-168 < t Initial program 99.0%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
associate-/r*90.6%
Simplified90.6%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (<= t 1.6e-168) (+ 1.0 (/ (/ x (- z y)) y)) (+ 1.0 (/ (/ x t) (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.6e-168) {
tmp = 1.0 + ((x / (z - 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.6d-168) then
tmp = 1.0d0 + ((x / (z - 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.6e-168) {
tmp = 1.0 + ((x / (z - y)) / y);
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.6e-168: tmp = 1.0 + ((x / (z - y)) / y) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.6e-168) tmp = Float64(1.0 + Float64(Float64(x / Float64(z - 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.6e-168) tmp = 1.0 + ((x / (z - y)) / y); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.6e-168], N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / y), $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.6 \cdot 10^{-168}:\\
\;\;\;\;1 + \frac{\frac{x}{z - y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 1.60000000000000003e-168Initial program 97.4%
Taylor expanded in t around 0 73.6%
*-commutative73.6%
associate-/r*74.1%
Simplified74.1%
if 1.60000000000000003e-168 < t Initial program 99.0%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
associate-/r*90.6%
Simplified90.6%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ (/ 1.0 (- y t)) (/ (- z y) x))))
double code(double x, double y, double z, double t) {
return 1.0 + ((1.0 / (y - t)) / ((z - y) / x));
}
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 + ((1.0d0 / (y - t)) / ((z - y) / x))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 + ((1.0 / (y - t)) / ((z - y) / x));
}
def code(x, y, z, t): return 1.0 + ((1.0 / (y - t)) / ((z - y) / x))
function code(x, y, z, t) return Float64(1.0 + Float64(Float64(1.0 / Float64(y - t)) / Float64(Float64(z - y) / x))) end
function tmp = code(x, y, z, t) tmp = 1.0 + ((1.0 / (y - t)) / ((z - y) / x)); end
code[x_, y_, z_, t_] := N[(1.0 + N[(N[(1.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{\frac{1}{y - t}}{\frac{z - y}{x}}
\end{array}
Initial program 98.1%
clear-num98.0%
inv-pow98.0%
*-commutative98.0%
associate-/l*98.7%
Applied egg-rr98.7%
unpow-198.7%
associate-/r*98.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (<= t 8.5e-108) (+ 1.0 (/ (/ x y) z)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8.5e-108) {
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 <= 8.5d-108) 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 <= 8.5e-108) {
tmp = 1.0 + ((x / y) / z);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 8.5e-108: tmp = 1.0 + ((x / y) / z) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 8.5e-108) tmp = Float64(1.0 + Float64(Float64(x / y) / z)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 8.5e-108) tmp = 1.0 + ((x / y) / z); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 8.5e-108], N[(1.0 + N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8.5 \cdot 10^{-108}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < 8.49999999999999986e-108Initial program 97.0%
Taylor expanded in t around 0 73.4%
*-commutative73.4%
associate-/r*73.9%
Simplified73.9%
Taylor expanded in z around inf 60.5%
associate-/r*59.9%
Simplified59.9%
if 8.49999999999999986e-108 < t Initial program 99.9%
Taylor expanded in x around 0 81.8%
Final simplification67.6%
(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 98.1%
Final simplification98.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 98.1%
Taylor expanded in x around 0 72.1%
Final simplification72.1%
herbie shell --seed 2024067
(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)))))