
(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) (- 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}
Initial program 99.2%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -4.6e+40)
(- 1.0 (/ x (* y t)))
(if (or (<= y -5.8e-99) (not (<= y 2e-34)))
(+ 1.0 (/ x (* y z)))
(- 1.0 (/ x (* z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.6e+40) {
tmp = 1.0 - (x / (y * t));
} else if ((y <= -5.8e-99) || !(y <= 2e-34)) {
tmp = 1.0 + (x / (y * z));
} 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 <= (-4.6d+40)) then
tmp = 1.0d0 - (x / (y * t))
else if ((y <= (-5.8d-99)) .or. (.not. (y <= 2d-34))) then
tmp = 1.0d0 + (x / (y * z))
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 <= -4.6e+40) {
tmp = 1.0 - (x / (y * t));
} else if ((y <= -5.8e-99) || !(y <= 2e-34)) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.6e+40: tmp = 1.0 - (x / (y * t)) elif (y <= -5.8e-99) or not (y <= 2e-34): tmp = 1.0 + (x / (y * z)) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.6e+40) tmp = Float64(1.0 - Float64(x / Float64(y * t))); elseif ((y <= -5.8e-99) || !(y <= 2e-34)) tmp = Float64(1.0 + Float64(x / Float64(y * z))); 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 <= -4.6e+40) tmp = 1.0 - (x / (y * t)); elseif ((y <= -5.8e-99) || ~((y <= 2e-34))) tmp = 1.0 + (x / (y * z)); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.6e+40], N[(1.0 - N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -5.8e-99], N[Not[LessEqual[y, 2e-34]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+40}:\\
\;\;\;\;1 - \frac{x}{y \cdot t}\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-99} \lor \neg \left(y \leq 2 \cdot 10^{-34}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -4.59999999999999987e40Initial program 100.0%
Taylor expanded in t around inf 75.3%
associate-*r/75.3%
neg-mul-175.3%
Simplified75.3%
Taylor expanded in y around inf 72.1%
expm1-log1p-u71.4%
expm1-udef71.4%
add-sqr-sqrt38.0%
sqrt-unprod65.3%
sqr-neg65.3%
sqrt-unprod33.4%
add-sqr-sqrt71.3%
Applied egg-rr71.3%
expm1-def71.3%
expm1-log1p72.2%
Simplified72.2%
if -4.59999999999999987e40 < y < -5.79999999999999971e-99 or 1.99999999999999986e-34 < y Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 77.4%
Taylor expanded in y around inf 73.3%
*-commutative73.3%
Simplified73.3%
if -5.79999999999999971e-99 < y < 1.99999999999999986e-34Initial program 97.8%
Taylor expanded in y around 0 81.0%
Final simplification75.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.6e+27) (not (<= y 2e+89))) (- 1.0 (/ x (* y y))) (+ 1.0 (/ x (* z (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.6e+27) || !(y <= 2e+89)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 + (x / (z * (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 ((y <= (-2.6d+27)) .or. (.not. (y <= 2d+89))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 + (x / (z * (y - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.6e+27) || !(y <= 2e+89)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 + (x / (z * (y - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.6e+27) or not (y <= 2e+89): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 + (x / (z * (y - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.6e+27) || !(y <= 2e+89)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.6e+27) || ~((y <= 2e+89))) tmp = 1.0 - (x / (y * y)); else tmp = 1.0 + (x / (z * (y - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.6e+27], N[Not[LessEqual[y, 2e+89]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+27} \lor \neg \left(y \leq 2 \cdot 10^{+89}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if y < -2.60000000000000009e27 or 1.99999999999999999e89 < y Initial program 100.0%
Taylor expanded in y around inf 99.2%
unpow299.2%
Simplified99.2%
if -2.60000000000000009e27 < y < 1.99999999999999999e89Initial program 98.6%
sub-neg98.6%
distribute-frac-neg98.6%
*-lft-identity98.6%
associate-/r*98.6%
associate-*r/98.6%
metadata-eval98.6%
times-frac98.6%
neg-mul-198.6%
remove-double-neg98.6%
neg-mul-198.6%
sub-neg98.6%
+-commutative98.6%
distribute-neg-out98.6%
remove-double-neg98.6%
sub-neg98.6%
Simplified98.6%
Taylor expanded in z around inf 82.9%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.8e-53) (not (<= y 6.4e+16))) (+ 1.0 (/ (/ x y) (- z y))) (+ 1.0 (/ x (* z (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.8e-53) || !(y <= 6.4e+16)) {
tmp = 1.0 + ((x / y) / (z - y));
} else {
tmp = 1.0 + (x / (z * (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 ((y <= (-6.8d-53)) .or. (.not. (y <= 6.4d+16))) then
tmp = 1.0d0 + ((x / y) / (z - y))
else
tmp = 1.0d0 + (x / (z * (y - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.8e-53) || !(y <= 6.4e+16)) {
tmp = 1.0 + ((x / y) / (z - y));
} else {
tmp = 1.0 + (x / (z * (y - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.8e-53) or not (y <= 6.4e+16): tmp = 1.0 + ((x / y) / (z - y)) else: tmp = 1.0 + (x / (z * (y - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.8e-53) || !(y <= 6.4e+16)) tmp = Float64(1.0 + Float64(Float64(x / y) / Float64(z - y))); else tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.8e-53) || ~((y <= 6.4e+16))) tmp = 1.0 + ((x / y) / (z - y)); else tmp = 1.0 + (x / (z * (y - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.8e-53], N[Not[LessEqual[y, 6.4e+16]], $MachinePrecision]], N[(1.0 + N[(N[(x / y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{-53} \lor \neg \left(y \leq 6.4 \cdot 10^{+16}\right):\\
\;\;\;\;1 + \frac{\frac{x}{y}}{z - y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if y < -6.8e-53 or 6.4e16 < y Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in t around 0 96.2%
associate-/r*96.2%
Simplified96.2%
if -6.8e-53 < y < 6.4e16Initial program 98.2%
sub-neg98.2%
distribute-frac-neg98.2%
*-lft-identity98.2%
associate-/r*98.2%
associate-*r/98.2%
metadata-eval98.2%
times-frac98.2%
neg-mul-198.2%
remove-double-neg98.2%
neg-mul-198.2%
sub-neg98.2%
+-commutative98.2%
distribute-neg-out98.2%
remove-double-neg98.2%
sub-neg98.2%
Simplified98.2%
Taylor expanded in z around inf 85.0%
Final simplification91.4%
(FPCore (x y z t)
:precision binary64
(if (<= t -5.8e-189)
(+ 1.0 (/ x (* z (- y t))))
(if (<= t 1.28e-62)
(+ 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 (t <= -5.8e-189) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (t <= 1.28e-62) {
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 (t <= (-5.8d-189)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (t <= 1.28d-62) 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 (t <= -5.8e-189) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (t <= 1.28e-62) {
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 t <= -5.8e-189: tmp = 1.0 + (x / (z * (y - t))) elif t <= 1.28e-62: 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 (t <= -5.8e-189) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (t <= 1.28e-62) tmp = Float64(1.0 + Float64(Float64(x / 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 (t <= -5.8e-189) tmp = 1.0 + (x / (z * (y - t))); elseif (t <= 1.28e-62) 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[LessEqual[t, -5.8e-189], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.28e-62], N[(1.0 + N[(N[(x / y), $MachinePrecision] / N[(z - y), $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}\;t \leq -5.8 \cdot 10^{-189}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;t \leq 1.28 \cdot 10^{-62}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{z - y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if t < -5.8e-189Initial program 99.2%
sub-neg99.2%
distribute-frac-neg99.2%
*-lft-identity99.2%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 83.4%
if -5.8e-189 < t < 1.27999999999999996e-62Initial program 98.5%
sub-neg98.5%
distribute-frac-neg98.5%
*-lft-identity98.5%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in t around 0 94.2%
associate-/r*94.1%
Simplified94.1%
if 1.27999999999999996e-62 < t Initial program 100.0%
Taylor expanded in t around inf 96.9%
associate-*r/96.9%
neg-mul-196.9%
Simplified96.9%
frac-2neg96.9%
div-inv96.8%
remove-double-neg96.8%
distribute-rgt-neg-in96.8%
Applied egg-rr96.8%
associate-*r/96.9%
*-rgt-identity96.9%
neg-sub096.9%
associate--r-96.9%
neg-sub096.9%
+-commutative96.9%
sub-neg96.9%
Simplified96.9%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.4e-99) (not (<= y 7.5e-35))) (+ 1.0 (/ x (* y z))) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.4e-99) || !(y <= 7.5e-35)) {
tmp = 1.0 + (x / (y * z));
} 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 <= (-5.4d-99)) .or. (.not. (y <= 7.5d-35))) then
tmp = 1.0d0 + (x / (y * z))
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 <= -5.4e-99) || !(y <= 7.5e-35)) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.4e-99) or not (y <= 7.5e-35): tmp = 1.0 + (x / (y * z)) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.4e-99) || !(y <= 7.5e-35)) tmp = Float64(1.0 + Float64(x / Float64(y * z))); 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 <= -5.4e-99) || ~((y <= 7.5e-35))) tmp = 1.0 + (x / (y * z)); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.4e-99], N[Not[LessEqual[y, 7.5e-35]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{-99} \lor \neg \left(y \leq 7.5 \cdot 10^{-35}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -5.4e-99 or 7.5e-35 < y Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 76.6%
Taylor expanded in y around inf 72.6%
*-commutative72.6%
Simplified72.6%
if -5.4e-99 < y < 7.5e-35Initial program 97.8%
Taylor expanded in y around 0 81.0%
Final simplification75.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.5e-47) (not (<= y 1.22e+35))) (- 1.0 (/ x (* y y))) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.5e-47) || !(y <= 1.22e+35)) {
tmp = 1.0 - (x / (y * 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 <= (-5.5d-47)) .or. (.not. (y <= 1.22d+35))) then
tmp = 1.0d0 - (x / (y * 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 <= -5.5e-47) || !(y <= 1.22e+35)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.5e-47) or not (y <= 1.22e+35): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.5e-47) || !(y <= 1.22e+35)) tmp = Float64(1.0 - Float64(x / Float64(y * 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 <= -5.5e-47) || ~((y <= 1.22e+35))) tmp = 1.0 - (x / (y * y)); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.5e-47], N[Not[LessEqual[y, 1.22e+35]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{-47} \lor \neg \left(y \leq 1.22 \cdot 10^{+35}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -5.5000000000000002e-47 or 1.21999999999999999e35 < y Initial program 100.0%
Taylor expanded in y around inf 92.9%
unpow292.9%
Simplified92.9%
if -5.5000000000000002e-47 < y < 1.21999999999999999e35Initial program 98.2%
Taylor expanded in y around 0 77.8%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ (/ x (- z y)) (- y t))))
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (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 / (z - y)) / (y - t))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (y - t));
}
def code(x, y, z, t): return 1.0 + ((x / (z - y)) / (y - t))
function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t))) end
function tmp = code(x, y, z, t) tmp = 1.0 + ((x / (z - y)) / (y - t)); end
code[x_, y_, z_, t_] := N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{\frac{x}{z - y}}{y - t}
\end{array}
Initial program 99.2%
sub-neg99.2%
distribute-frac-neg99.2%
*-lft-identity99.2%
associate-/r*99.2%
associate-*r/99.2%
metadata-eval99.2%
times-frac99.2%
neg-mul-199.2%
remove-double-neg99.2%
neg-mul-199.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-out99.2%
remove-double-neg99.2%
sub-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ x (* y z))))
double code(double x, double y, double z, double t) {
return 1.0 + (x / (y * z));
}
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))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 + (x / (y * z));
}
def code(x, y, z, t): return 1.0 + (x / (y * z))
function code(x, y, z, t) return Float64(1.0 + Float64(x / Float64(y * z))) end
function tmp = code(x, y, z, t) tmp = 1.0 + (x / (y * z)); end
code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{x}{y \cdot z}
\end{array}
Initial program 99.2%
sub-neg99.2%
distribute-frac-neg99.2%
*-lft-identity99.2%
associate-/r*99.2%
associate-*r/99.2%
metadata-eval99.2%
times-frac99.2%
neg-mul-199.2%
remove-double-neg99.2%
neg-mul-199.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-out99.2%
remove-double-neg99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in z around inf 79.9%
Taylor expanded in y around inf 61.5%
*-commutative61.5%
Simplified61.5%
Final simplification61.5%
herbie shell --seed 2023279
(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)))))