
(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 8 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: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 2.3e+50) (+ 1.0 (/ (/ x (- z y)) (- y t))) (+ 1.0 (/ x (* (- y z) t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.3e+50) {
tmp = 1.0 + ((x / (z - y)) / (y - t));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
NOTE: x, y, 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 (t <= 2.3d+50) then
tmp = 1.0d0 + ((x / (z - y)) / (y - t))
else
tmp = 1.0d0 + (x / ((y - z) * t))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.3e+50) {
tmp = 1.0 + ((x / (z - y)) / (y - t));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 2.3e+50: tmp = 1.0 + ((x / (z - y)) / (y - t)) else: tmp = 1.0 + (x / ((y - z) * t)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 2.3e+50) tmp = Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t))); else tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 2.3e+50)
tmp = 1.0 + ((x / (z - y)) / (y - t));
else
tmp = 1.0 + (x / ((y - z) * t));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 2.3e+50], N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.3 \cdot 10^{+50}:\\
\;\;\;\;1 + \frac{\frac{x}{z - y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if t < 2.29999999999999997e50Initial program 99.4%
sub-neg99.4%
neg-mul-199.4%
*-commutative99.4%
*-commutative99.4%
associate-/r*98.9%
associate-*r/98.9%
metadata-eval98.9%
times-frac98.9%
*-lft-identity98.9%
neg-mul-198.9%
sub-neg98.9%
+-commutative98.9%
distribute-neg-out98.9%
remove-double-neg98.9%
sub-neg98.9%
Simplified98.9%
if 2.29999999999999997e50 < t Initial program 99.9%
Taylor expanded in t around inf 99.8%
Final simplification99.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -3.35e-6) 1.0 (if (<= y 1.35e-18) (+ 1.0 (/ x (* (- y z) t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.35e-6) {
tmp = 1.0;
} else if (y <= 1.35e-18) {
tmp = 1.0 + (x / ((y - z) * t));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, 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 <= (-3.35d-6)) then
tmp = 1.0d0
else if (y <= 1.35d-18) then
tmp = 1.0d0 + (x / ((y - z) * t))
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.35e-6) {
tmp = 1.0;
} else if (y <= 1.35e-18) {
tmp = 1.0 + (x / ((y - z) * t));
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -3.35e-6: tmp = 1.0 elif y <= 1.35e-18: tmp = 1.0 + (x / ((y - z) * t)) else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -3.35e-6) tmp = 1.0; elseif (y <= 1.35e-18) tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -3.35e-6)
tmp = 1.0;
elseif (y <= 1.35e-18)
tmp = 1.0 + (x / ((y - z) * t));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -3.35e-6], 1.0, If[LessEqual[y, 1.35e-18], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.35 \cdot 10^{-6}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-18}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.35e-6 or 1.34999999999999994e-18 < y Initial program 100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
*-commutative100.0%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
*-lft-identity100.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 x around 0 97.0%
if -3.35e-6 < y < 1.34999999999999994e-18Initial program 99.1%
Taylor expanded in t around inf 80.8%
Final simplification89.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -4.8e-132)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 1.42e-142)
(- 1.0 (/ x (* y (- y t))))
(+ 1.0 (/ x (* (- y z) t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.8e-132) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.42e-142) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
NOTE: x, y, 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 <= (-4.8d-132)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 1.42d-142) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 + (x / ((y - z) * t))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.8e-132) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.42e-142) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -4.8e-132: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 1.42e-142: tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 + (x / ((y - z) * t)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -4.8e-132) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 1.42e-142) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -4.8e-132)
tmp = 1.0 + ((x / z) / (y - t));
elseif (z <= 1.42e-142)
tmp = 1.0 - (x / (y * (y - t)));
else
tmp = 1.0 + (x / ((y - z) * t));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -4.8e-132], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.42e-142], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-132}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 1.42 \cdot 10^{-142}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if z < -4.80000000000000031e-132Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*98.8%
associate-*r/98.8%
metadata-eval98.8%
times-frac98.8%
*-lft-identity98.8%
neg-mul-198.8%
sub-neg98.8%
+-commutative98.8%
distribute-neg-out98.8%
remove-double-neg98.8%
sub-neg98.8%
Simplified98.8%
Taylor expanded in z around inf 95.6%
+-commutative95.6%
associate-/r*94.5%
Simplified94.5%
if -4.80000000000000031e-132 < z < 1.42000000000000007e-142Initial program 98.6%
sub-neg98.6%
neg-mul-198.6%
*-commutative98.6%
*-commutative98.6%
associate-/r*94.7%
associate-*r/94.7%
metadata-eval94.7%
times-frac94.7%
*-lft-identity94.7%
neg-mul-194.7%
sub-neg94.7%
+-commutative94.7%
distribute-neg-out94.7%
remove-double-neg94.7%
sub-neg94.7%
Simplified94.7%
Taylor expanded in z around 0 91.5%
mul-1-neg91.5%
sub-neg91.5%
Simplified91.5%
if 1.42000000000000007e-142 < z Initial program 100.0%
Taylor expanded in t around inf 76.9%
Final simplification87.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t -1.2e-100) 1.0 (if (<= t 7e-274) (+ 1.0 (/ x (* y z))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e-100) {
tmp = 1.0;
} else if (t <= 7e-274) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, 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 (t <= (-1.2d-100)) then
tmp = 1.0d0
else if (t <= 7d-274) then
tmp = 1.0d0 + (x / (y * z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e-100) {
tmp = 1.0;
} else if (t <= 7e-274) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= -1.2e-100: tmp = 1.0 elif t <= 7e-274: tmp = 1.0 + (x / (y * z)) else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -1.2e-100) tmp = 1.0; elseif (t <= 7e-274) tmp = Float64(1.0 + Float64(x / Float64(y * z))); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= -1.2e-100)
tmp = 1.0;
elseif (t <= 7e-274)
tmp = 1.0 + (x / (y * z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, -1.2e-100], 1.0, If[LessEqual[t, 7e-274], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-100}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-274}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -1.2000000000000001e-100 or 6.99999999999999963e-274 < t Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*97.5%
associate-*r/97.5%
metadata-eval97.5%
times-frac97.5%
*-lft-identity97.5%
neg-mul-197.5%
sub-neg97.5%
+-commutative97.5%
distribute-neg-out97.5%
remove-double-neg97.5%
sub-neg97.5%
Simplified97.5%
Taylor expanded in x around 0 82.1%
if -1.2000000000000001e-100 < t < 6.99999999999999963e-274Initial program 98.3%
sub-neg98.3%
neg-mul-198.3%
*-commutative98.3%
*-commutative98.3%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.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 79.7%
+-commutative79.7%
associate-/r*79.8%
Simplified79.8%
Taylor expanded in y around inf 71.5%
*-commutative71.5%
Simplified71.5%
Final simplification79.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -2.3e-6) 1.0 (if (<= y 1.4e-86) (- 1.0 (/ x (* z t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.3e-6) {
tmp = 1.0;
} else if (y <= 1.4e-86) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, 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.3d-6)) then
tmp = 1.0d0
else if (y <= 1.4d-86) then
tmp = 1.0d0 - (x / (z * t))
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.3e-6) {
tmp = 1.0;
} else if (y <= 1.4e-86) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -2.3e-6: tmp = 1.0 elif y <= 1.4e-86: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -2.3e-6) tmp = 1.0; elseif (y <= 1.4e-86) tmp = Float64(1.0 - Float64(x / Float64(z * t))); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -2.3e-6)
tmp = 1.0;
elseif (y <= 1.4e-86)
tmp = 1.0 - (x / (z * t));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -2.3e-6], 1.0, If[LessEqual[y, 1.4e-86], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-6}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-86}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.3e-6 or 1.40000000000000005e-86 < y Initial program 100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
*-commutative100.0%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.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 x around 0 93.3%
if -2.3e-6 < y < 1.40000000000000005e-86Initial program 99.0%
sub-neg99.0%
neg-mul-199.0%
*-commutative99.0%
*-commutative99.0%
associate-/r*95.5%
associate-*r/95.5%
metadata-eval95.5%
times-frac95.5%
*-lft-identity95.5%
neg-mul-195.5%
sub-neg95.5%
+-commutative95.5%
distribute-neg-out95.5%
remove-double-neg95.5%
sub-neg95.5%
Simplified95.5%
Taylor expanded in y around 0 75.2%
mul-1-neg75.2%
sub-neg75.2%
Simplified75.2%
Final simplification85.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -1.6e-50) (+ 1.0 (/ (/ x z) (- y t))) (+ 1.0 (/ x (* (- y z) t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-50) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
NOTE: x, y, 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.6d-50)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else
tmp = 1.0d0 + (x / ((y - z) * t))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-50) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.6e-50: tmp = 1.0 + ((x / z) / (y - t)) else: tmp = 1.0 + (x / ((y - z) * t)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e-50) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); else tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -1.6e-50)
tmp = 1.0 + ((x / z) / (y - t));
else
tmp = 1.0 + (x / ((y - z) * t));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e-50], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-50}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if z < -1.6e-50Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.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 97.4%
+-commutative97.4%
associate-/r*97.4%
Simplified97.4%
if -1.6e-50 < z Initial program 99.4%
Taylor expanded in t around inf 77.9%
Final simplification83.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
NOTE: x, y, 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 / ((y - z) * (y - t)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - z) * (y - t)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. 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}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Initial program 99.5%
Final simplification99.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: x, y, 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 x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 99.5%
sub-neg99.5%
neg-mul-199.5%
*-commutative99.5%
*-commutative99.5%
associate-/r*98.1%
associate-*r/98.1%
metadata-eval98.1%
times-frac98.1%
*-lft-identity98.1%
neg-mul-198.1%
sub-neg98.1%
+-commutative98.1%
distribute-neg-out98.1%
remove-double-neg98.1%
sub-neg98.1%
Simplified98.1%
Taylor expanded in x around 0 76.9%
Final simplification76.9%
herbie shell --seed 2024021
(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)))))