
(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 10 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 (+ 1.0 (/ (/ 1.0 (- t y)) (/ (- y z) x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((1.0 / (t - y)) / ((y - z) / x));
}
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 + ((1.0d0 / (t - y)) / ((y - z) / x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((1.0 / (t - y)) / ((y - z) / x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((1.0 / (t - y)) / ((y - z) / x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(1.0 / Float64(t - y)) / Float64(Float64(y - z) / x))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((1.0 / (t - y)) / ((y - z) / x));
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[(N[(1.0 / N[(t - y), $MachinePrecision]), $MachinePrecision] / N[(N[(y - z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{1}{t - y}}{\frac{y - z}{x}}
\end{array}
Initial program 98.8%
clear-num98.8%
associate-/r/98.8%
*-commutative98.8%
associate-/r*98.8%
Applied egg-rr98.8%
associate-/r/98.2%
Applied egg-rr98.2%
Final simplification98.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 (<= t -9e-170)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= t 1.45e-71)
(+ 1.0 (/ -1.0 (* y (/ (- y z) x))))
(+ 1.0 (/ (/ x t) (- y z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e-170) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 1.45e-71) {
tmp = 1.0 + (-1.0 / (y * ((y - z) / x)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
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 <= (-9d-170)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 1.45d-71) then
tmp = 1.0d0 + ((-1.0d0) / (y * ((y - z) / x)))
else
tmp = 1.0d0 + ((x / t) / (y - z))
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 <= -9e-170) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 1.45e-71) {
tmp = 1.0 + (-1.0 / (y * ((y - z) / x)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= -9e-170: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 1.45e-71: tmp = 1.0 + (-1.0 / (y * ((y - z) / x))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -9e-170) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 1.45e-71) tmp = Float64(1.0 + Float64(-1.0 / Float64(y * Float64(Float64(y - z) / x)))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); 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 <= -9e-170)
tmp = 1.0 + ((x / z) / (y - t));
elseif (t <= 1.45e-71)
tmp = 1.0 + (-1.0 / (y * ((y - z) / x)));
else
tmp = 1.0 + ((x / t) / (y - z));
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, -9e-170], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e-71], N[(1.0 + N[(-1.0 / N[(y * N[(N[(y - z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-170}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{-71}:\\
\;\;\;\;1 + \frac{-1}{y \cdot \frac{y - z}{x}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -9.00000000000000003e-170Initial program 100.0%
Taylor expanded in z around inf 78.5%
+-commutative78.5%
associate-/r*77.4%
Simplified77.4%
if -9.00000000000000003e-170 < t < 1.4499999999999999e-71Initial program 95.5%
clear-num95.4%
inv-pow95.4%
*-commutative95.4%
associate-/l*99.8%
Applied egg-rr99.8%
unpow-199.8%
Simplified99.8%
Taylor expanded in t around 0 86.6%
associate-*r/89.6%
Simplified89.6%
if 1.4499999999999999e-71 < t Initial program 99.9%
Taylor expanded in t around inf 97.9%
+-commutative97.9%
associate-/r*97.9%
Simplified97.9%
Final simplification88.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 (<= t -2e-183)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= t 2.2e-71)
(+ 1.0 (/ (/ x y) (- z y)))
(+ 1.0 (/ (/ x t) (- y z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2e-183) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 2.2e-71) {
tmp = 1.0 + ((x / y) / (z - y));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
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 <= (-2d-183)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 2.2d-71) then
tmp = 1.0d0 + ((x / y) / (z - y))
else
tmp = 1.0d0 + ((x / t) / (y - z))
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 <= -2e-183) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 2.2e-71) {
tmp = 1.0 + ((x / y) / (z - y));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= -2e-183: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 2.2e-71: tmp = 1.0 + ((x / y) / (z - y)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -2e-183) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 2.2e-71) tmp = Float64(1.0 + Float64(Float64(x / y) / Float64(z - y))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); 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 <= -2e-183)
tmp = 1.0 + ((x / z) / (y - t));
elseif (t <= 2.2e-71)
tmp = 1.0 + ((x / y) / (z - y));
else
tmp = 1.0 + ((x / t) / (y - z));
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, -2e-183], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.2e-71], N[(1.0 + N[(N[(x / y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{-183}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-71}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{z - y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -2.00000000000000001e-183Initial program 100.0%
Taylor expanded in z around inf 78.9%
+-commutative78.9%
associate-/r*77.9%
Simplified77.9%
if -2.00000000000000001e-183 < t < 2.19999999999999997e-71Initial program 95.3%
Taylor expanded in t around 0 87.8%
associate-/r*90.7%
Simplified90.7%
if 2.19999999999999997e-71 < t Initial program 99.9%
Taylor expanded in t around inf 97.9%
+-commutative97.9%
associate-/r*97.9%
Simplified97.9%
Final simplification88.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 -6.8e-65) 1.0 (if (<= y 6.5e-33) (- 1.0 (/ x (* t z))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.8e-65) {
tmp = 1.0;
} else if (y <= 6.5e-33) {
tmp = 1.0 - (x / (t * 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 (y <= (-6.8d-65)) then
tmp = 1.0d0
else if (y <= 6.5d-33) then
tmp = 1.0d0 - (x / (t * 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 (y <= -6.8e-65) {
tmp = 1.0;
} else if (y <= 6.5e-33) {
tmp = 1.0 - (x / (t * 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 y <= -6.8e-65: tmp = 1.0 elif y <= 6.5e-33: tmp = 1.0 - (x / (t * 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 (y <= -6.8e-65) tmp = 1.0; elseif (y <= 6.5e-33) tmp = Float64(1.0 - Float64(x / Float64(t * 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 (y <= -6.8e-65)
tmp = 1.0;
elseif (y <= 6.5e-33)
tmp = 1.0 - (x / (t * 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[y, -6.8e-65], 1.0, If[LessEqual[y, 6.5e-33], N[(1.0 - N[(x / N[(t * z), $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 -6.8 \cdot 10^{-65}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-33}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.79999999999999973e-65 or 6.4999999999999993e-33 < y Initial program 99.9%
Taylor expanded in x around 0 88.4%
if -6.79999999999999973e-65 < y < 6.4999999999999993e-33Initial program 97.1%
Taylor expanded in y around 0 79.7%
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 -5.4e-145) 1.0 (if (<= z 1.5e-155) (+ 1.0 (/ x (* y t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.4e-145) {
tmp = 1.0;
} else if (z <= 1.5e-155) {
tmp = 1.0 + (x / (y * 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 (z <= (-5.4d-145)) then
tmp = 1.0d0
else if (z <= 1.5d-155) then
tmp = 1.0d0 + (x / (y * 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 (z <= -5.4e-145) {
tmp = 1.0;
} else if (z <= 1.5e-155) {
tmp = 1.0 + (x / (y * 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 z <= -5.4e-145: tmp = 1.0 elif z <= 1.5e-155: tmp = 1.0 + (x / (y * 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 (z <= -5.4e-145) tmp = 1.0; elseif (z <= 1.5e-155) tmp = Float64(1.0 + Float64(x / Float64(y * 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 (z <= -5.4e-145)
tmp = 1.0;
elseif (z <= 1.5e-155)
tmp = 1.0 + (x / (y * 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[z, -5.4e-145], 1.0, If[LessEqual[z, 1.5e-155], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-145}:\\
\;\;\;\;1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-155}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -5.4000000000000001e-145 or 1.49999999999999992e-155 < z Initial program 99.5%
Taylor expanded in x around 0 79.3%
if -5.4000000000000001e-145 < z < 1.49999999999999992e-155Initial program 96.1%
Taylor expanded in t around inf 84.8%
+-commutative84.8%
associate-/r*84.8%
Simplified84.8%
Taylor expanded in y around inf 77.7%
Final simplification79.0%
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 6.5e-81) (+ 1.0 (/ (/ x z) (- y t))) (+ 1.0 (/ (/ x t) (- y z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 6.5e-81) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
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 <= 6.5d-81) then
tmp = 1.0d0 + ((x / z) / (y - t))
else
tmp = 1.0d0 + ((x / t) / (y - z))
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 <= 6.5e-81) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 6.5e-81: tmp = 1.0 + ((x / z) / (y - t)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 6.5e-81) 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
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 6.5e-81)
tmp = 1.0 + ((x / z) / (y - t));
else
tmp = 1.0 + ((x / t) / (y - z));
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, 6.5e-81], 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}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.5 \cdot 10^{-81}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 6.5000000000000002e-81Initial program 98.2%
Taylor expanded in z around inf 78.8%
+-commutative78.8%
associate-/r*78.8%
Simplified78.8%
if 6.5000000000000002e-81 < t Initial program 99.9%
Taylor expanded in t around inf 97.9%
+-commutative97.9%
associate-/r*97.9%
Simplified97.9%
Final simplification86.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 4.4e-92) (+ 1.0 (/ x (* y z))) (+ 1.0 (/ (/ x t) (- y z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 4.4e-92) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
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 <= 4.4d-92) then
tmp = 1.0d0 + (x / (y * z))
else
tmp = 1.0d0 + ((x / t) / (y - z))
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 <= 4.4e-92) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 4.4e-92: tmp = 1.0 + (x / (y * z)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 4.4e-92) tmp = Float64(1.0 + Float64(x / Float64(y * z))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); 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 <= 4.4e-92)
tmp = 1.0 + (x / (y * z));
else
tmp = 1.0 + ((x / t) / (y - z));
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, 4.4e-92], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.4 \cdot 10^{-92}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 4.39999999999999974e-92Initial program 98.1%
Taylor expanded in z around inf 78.6%
+-commutative78.6%
associate-/r*78.6%
Simplified78.6%
Taylor expanded in y around inf 63.7%
if 4.39999999999999974e-92 < t Initial program 99.9%
Taylor expanded in t around inf 98.0%
+-commutative98.0%
associate-/r*98.0%
Simplified98.0%
Final simplification77.0%
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 (/ 1.0 (* (- y t) (/ (- z y) x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (1.0 / ((y - t) * ((z - y) / x)));
}
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 + (1.0d0 / ((y - t) * ((z - y) / x)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (1.0 / ((y - t) * ((z - y) / x)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (1.0 / ((y - t) * ((z - y) / x)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(1.0 / Float64(Float64(y - t) * Float64(Float64(z - y) / x)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (1.0 / ((y - t) * ((z - y) / x)));
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[(1.0 / N[(N[(y - t), $MachinePrecision] * N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{1}{\left(y - t\right) \cdot \frac{z - y}{x}}
\end{array}
Initial program 98.8%
clear-num98.8%
inv-pow98.8%
*-commutative98.8%
associate-/l*98.2%
Applied egg-rr98.2%
unpow-198.2%
Simplified98.2%
Final simplification98.2%
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 t) (- y z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - t) * (y - z)));
}
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 - t) * (y - z)))
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 - t) * (y - z)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - t) * (y - z)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - t) * Float64(y - z)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - t) * (y - z)));
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 - t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \frac{x}{\left(y - t\right) \cdot \left(y - z\right)}
\end{array}
Initial program 98.8%
Final simplification98.8%
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 98.8%
Taylor expanded in x around 0 78.0%
herbie shell --seed 2024111
(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)))))