
(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}
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (/ (/ x (- z y)) (- y t))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (y - t));
}
NOTE: z and t should be sorted in increasing order before calling this function.
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
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (y - t));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 + ((x / (z - y)) / (y - t))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (z - y)) / (y - t));
end
NOTE: z and t should be sorted in increasing order before calling this function. 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 + \frac{\frac{x}{z - y}}{y - t}
\end{array}
Initial program 98.4%
sub-neg98.4%
distribute-frac-neg98.4%
*-lft-identity98.4%
associate-/r*98.1%
associate-*r/98.1%
metadata-eval98.1%
times-frac98.1%
neg-mul-198.1%
remove-double-neg98.1%
neg-mul-198.1%
sub-neg98.1%
+-commutative98.1%
distribute-neg-out98.1%
remove-double-neg98.1%
sub-neg98.1%
Simplified98.1%
Final simplification98.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -2.7e+89) (- 1.0 (/ x (* y y))) (if (<= y 4200.0) (+ 1.0 (/ x (* z (- y t)))) 1.0)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.7e+89) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 4200.0) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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.7d+89)) then
tmp = 1.0d0 - (x / (y * y))
else if (y <= 4200.0d0) then
tmp = 1.0d0 + (x / (z * (y - t)))
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.7e+89) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 4200.0) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -2.7e+89: tmp = 1.0 - (x / (y * y)) elif y <= 4200.0: tmp = 1.0 + (x / (z * (y - t))) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -2.7e+89) tmp = Float64(1.0 - Float64(x / Float64(y * y))); elseif (y <= 4200.0) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -2.7e+89)
tmp = 1.0 - (x / (y * y));
elseif (y <= 4200.0)
tmp = 1.0 + (x / (z * (y - t)));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -2.7e+89], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4200.0], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+89}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{elif}\;y \leq 4200:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.7e89Initial program 100.0%
Taylor expanded in y around inf 98.4%
unpow298.4%
Simplified98.4%
if -2.7e89 < y < 4200Initial program 97.1%
sub-neg97.1%
distribute-frac-neg97.1%
*-lft-identity97.1%
associate-/r*96.5%
associate-*r/96.5%
metadata-eval96.5%
times-frac96.5%
neg-mul-196.5%
remove-double-neg96.5%
neg-mul-196.5%
sub-neg96.5%
+-commutative96.5%
distribute-neg-out96.5%
remove-double-neg96.5%
sub-neg96.5%
Simplified96.5%
Taylor expanded in z around inf 80.7%
*-commutative80.7%
Simplified80.7%
if 4200 < y Initial program 100.0%
Taylor expanded in y around 0 60.2%
Taylor expanded in x around 0 95.8%
Final simplification88.0%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -1.5e-66)
(+ 1.0 (/ x (* z (- y t))))
(if (<= z 9.2e-141)
(- 1.0 (/ x (* y (- y t))))
(+ 1.0 (/ (/ x t) (- y z))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.5e-66) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 9.2e-141) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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.5d-66)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 9.2d-141) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.5e-66) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 9.2e-141) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.5e-66: tmp = 1.0 + (x / (z * (y - t))) elif z <= 9.2e-141: tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.5e-66) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 9.2e-141) 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
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -1.5e-66)
tmp = 1.0 + (x / (z * (y - t)));
elseif (z <= 9.2e-141)
tmp = 1.0 - (x / (y * (y - t)));
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -1.5e-66], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e-141], 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-66}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-141}:\\
\;\;\;\;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.5000000000000001e-66Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
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 95.8%
*-commutative95.8%
Simplified95.8%
if -1.5000000000000001e-66 < z < 9.1999999999999998e-141Initial program 95.2%
Taylor expanded in z around 0 87.8%
if 9.1999999999999998e-141 < z Initial program 99.9%
Taylor expanded in t around inf 76.9%
associate-/r*75.7%
associate-*r/75.7%
associate-*r/75.7%
neg-mul-175.7%
Simplified75.7%
Taylor expanded in x around 0 76.9%
associate-/r*75.7%
Simplified75.7%
Final simplification86.5%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -1.25e-65)
(+ 1.0 (/ x (* z (- y t))))
(if (<= z 1.6e-143)
(- 1.0 (/ (/ x y) (- y t)))
(+ 1.0 (/ (/ x t) (- y z))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-65) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 1.6e-143) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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-65)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 1.6d-143) then
tmp = 1.0d0 - ((x / y) / (y - t))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-65) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 1.6e-143) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.25e-65: tmp = 1.0 + (x / (z * (y - t))) elif z <= 1.6e-143: tmp = 1.0 - ((x / y) / (y - t)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.25e-65) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 1.6e-143) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -1.25e-65)
tmp = 1.0 + (x / (z * (y - t)));
elseif (z <= 1.6e-143)
tmp = 1.0 - ((x / y) / (y - t));
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -1.25e-65], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e-143], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-65}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-143}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -1.24999999999999996e-65Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
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 95.8%
*-commutative95.8%
Simplified95.8%
if -1.24999999999999996e-65 < z < 1.5999999999999999e-143Initial program 95.2%
Taylor expanded in z around 0 87.8%
associate-/r*86.7%
Simplified86.7%
if 1.5999999999999999e-143 < z Initial program 99.9%
Taylor expanded in t around inf 76.9%
associate-/r*75.7%
associate-*r/75.7%
associate-*r/75.7%
neg-mul-175.7%
Simplified75.7%
Taylor expanded in x around 0 76.9%
associate-/r*75.7%
Simplified75.7%
Final simplification86.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -7.4e-196) 1.0 (if (<= z 2.6e-307) (+ 1.0 (/ x (* y t))) 1.0)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.4e-196) {
tmp = 1.0;
} else if (z <= 2.6e-307) {
tmp = 1.0 + (x / (y * t));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 <= (-7.4d-196)) then
tmp = 1.0d0
else if (z <= 2.6d-307) then
tmp = 1.0d0 + (x / (y * t))
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.4e-196) {
tmp = 1.0;
} else if (z <= 2.6e-307) {
tmp = 1.0 + (x / (y * t));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -7.4e-196: tmp = 1.0 elif z <= 2.6e-307: tmp = 1.0 + (x / (y * t)) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -7.4e-196) tmp = 1.0; elseif (z <= 2.6e-307) tmp = Float64(1.0 + Float64(x / Float64(y * t))); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -7.4e-196)
tmp = 1.0;
elseif (z <= 2.6e-307)
tmp = 1.0 + (x / (y * t));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -7.4e-196], 1.0, If[LessEqual[z, 2.6e-307], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-196}:\\
\;\;\;\;1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-307}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -7.4000000000000002e-196 or 2.59999999999999996e-307 < z Initial program 98.3%
Taylor expanded in y around 0 67.7%
Taylor expanded in x around 0 76.1%
if -7.4000000000000002e-196 < z < 2.59999999999999996e-307Initial program 99.9%
Taylor expanded in t around inf 92.5%
associate-/r*92.5%
associate-*r/92.5%
associate-*r/92.5%
neg-mul-192.5%
Simplified92.5%
Taylor expanded in y around inf 88.7%
+-commutative88.7%
Simplified88.7%
Final simplification77.3%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -8e-58) 1.0 (if (<= y 2.25e-100) (- 1.0 (/ x (* z t))) 1.0)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8e-58) {
tmp = 1.0;
} else if (y <= 2.25e-100) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 <= (-8d-58)) then
tmp = 1.0d0
else if (y <= 2.25d-100) then
tmp = 1.0d0 - (x / (z * t))
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8e-58) {
tmp = 1.0;
} else if (y <= 2.25e-100) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -8e-58: tmp = 1.0 elif y <= 2.25e-100: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -8e-58) tmp = 1.0; elseif (y <= 2.25e-100) tmp = Float64(1.0 - Float64(x / Float64(z * t))); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -8e-58)
tmp = 1.0;
elseif (y <= 2.25e-100)
tmp = 1.0 - (x / (z * t));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -8e-58], 1.0, If[LessEqual[y, 2.25e-100], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-58}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{-100}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -8.0000000000000002e-58 or 2.25e-100 < y Initial program 100.0%
Taylor expanded in y around 0 55.2%
Taylor expanded in x around 0 87.6%
if -8.0000000000000002e-58 < y < 2.25e-100Initial program 95.7%
Taylor expanded in y around 0 79.0%
Final simplification84.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -7.2e-58) 1.0 (if (<= y 6.2e-99) (- 1.0 (/ (/ x t) z)) 1.0)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e-58) {
tmp = 1.0;
} else if (y <= 6.2e-99) {
tmp = 1.0 - ((x / t) / z);
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 <= (-7.2d-58)) then
tmp = 1.0d0
else if (y <= 6.2d-99) then
tmp = 1.0d0 - ((x / t) / z)
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e-58) {
tmp = 1.0;
} else if (y <= 6.2e-99) {
tmp = 1.0 - ((x / t) / z);
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -7.2e-58: tmp = 1.0 elif y <= 6.2e-99: tmp = 1.0 - ((x / t) / z) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -7.2e-58) tmp = 1.0; elseif (y <= 6.2e-99) tmp = Float64(1.0 - Float64(Float64(x / t) / z)); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -7.2e-58)
tmp = 1.0;
elseif (y <= 6.2e-99)
tmp = 1.0 - ((x / t) / z);
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -7.2e-58], 1.0, If[LessEqual[y, 6.2e-99], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-58}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-99}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.20000000000000019e-58 or 6.1999999999999997e-99 < y Initial program 100.0%
Taylor expanded in y around 0 55.2%
Taylor expanded in x around 0 87.6%
if -7.20000000000000019e-58 < y < 6.1999999999999997e-99Initial program 95.7%
Taylor expanded in y around 0 79.0%
associate-/r*79.1%
Simplified79.1%
Final simplification84.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -3.7e-97) (+ 1.0 (/ x (* z (- y t)))) (+ 1.0 (/ (/ x t) (- y z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.7e-97) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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.7d-97)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.7e-97) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -3.7e-97: tmp = 1.0 + (x / (z * (y - t))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -3.7e-97) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -3.7e-97)
tmp = 1.0 + (x / (z * (y - t)));
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -3.7e-97], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-97}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -3.69999999999999976e-97Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
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 94.8%
*-commutative94.8%
Simplified94.8%
if -3.69999999999999976e-97 < z Initial program 97.6%
Taylor expanded in t around inf 76.2%
associate-/r*76.8%
associate-*r/76.8%
associate-*r/76.8%
neg-mul-176.8%
Simplified76.8%
Taylor expanded in x around 0 76.2%
associate-/r*76.8%
Simplified76.8%
Final simplification83.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0
z, t = sort([z, t]) function code(x, y, z, t) return 1.0 end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1
\end{array}
Initial program 98.4%
Taylor expanded in y around 0 63.7%
Taylor expanded in x around 0 74.3%
Final simplification74.3%
herbie shell --seed 2023290
(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)))))