
(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 (pow (* (- y z) (/ (- y t) x)) -1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - pow(((y - z) * ((y - t) / x)), -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 - (((y - z) * ((y - t) / x)) ** (-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 - Math.pow(((y - z) * ((y - t) / x)), -1.0);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.pow(((y - z) * ((y - t) / x)), -1.0)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - (Float64(Float64(y - z) * Float64(Float64(y - t) / x)) ^ -1.0)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (((y - z) * ((y - t) / x)) ^ -1.0);
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[Power[N[(N[(y - z), $MachinePrecision] * N[(N[(y - t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-1}
\end{array}
Initial program 99.2%
clear-num99.1%
inv-pow99.1%
associate-/l*98.9%
Applied egg-rr98.9%
Final simplification98.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -4.4e-58) (not (<= y 5.2e-34))) (+ 1.0 (/ x (* y (- t y)))) (- 1.0 (/ (/ x z) t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.4e-58) || !(y <= 5.2e-34)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - ((x / 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 ((y <= (-4.4d-58)) .or. (.not. (y <= 5.2d-34))) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 - ((x / 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 ((y <= -4.4e-58) || !(y <= 5.2e-34)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - ((x / z) / t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (y <= -4.4e-58) or not (y <= 5.2e-34): tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 - ((x / z) / t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -4.4e-58) || !(y <= 5.2e-34)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 - Float64(Float64(x / 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 ((y <= -4.4e-58) || ~((y <= 5.2e-34)))
tmp = 1.0 + (x / (y * (t - y)));
else
tmp = 1.0 - ((x / 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[Or[LessEqual[y, -4.4e-58], N[Not[LessEqual[y, 5.2e-34]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-58} \lor \neg \left(y \leq 5.2 \cdot 10^{-34}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\end{array}
\end{array}
if y < -4.40000000000000011e-58 or 5.1999999999999999e-34 < y Initial program 99.9%
Taylor expanded in z around 0 91.6%
if -4.40000000000000011e-58 < y < 5.1999999999999999e-34Initial program 98.1%
clear-num98.1%
inv-pow98.1%
associate-/l*97.5%
Applied egg-rr97.5%
Taylor expanded in y around 0 81.2%
*-commutative81.2%
associate-/r*81.3%
Simplified81.3%
Final simplification87.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 (<= y -2.6e-64) 1.0 (if (<= y 5.5e-33) (- 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.6e-64) {
tmp = 1.0;
} else if (y <= 5.5e-33) {
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.6d-64)) then
tmp = 1.0d0
else if (y <= 5.5d-33) 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.6e-64) {
tmp = 1.0;
} else if (y <= 5.5e-33) {
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.6e-64: tmp = 1.0 elif y <= 5.5e-33: 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.6e-64) tmp = 1.0; elseif (y <= 5.5e-33) 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.6e-64)
tmp = 1.0;
elseif (y <= 5.5e-33)
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.6e-64], 1.0, If[LessEqual[y, 5.5e-33], 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.6 \cdot 10^{-64}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-33}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.6e-64 or 5.5e-33 < y Initial program 99.9%
Taylor expanded in y around 0 55.9%
associate-/r*55.9%
div-inv55.9%
Applied egg-rr55.9%
*-commutative55.9%
frac-2neg55.9%
associate-*r/55.9%
add-sqr-sqrt27.3%
sqrt-unprod55.2%
sqr-neg55.2%
sqrt-unprod27.5%
add-sqr-sqrt54.5%
associate-/r/54.5%
clear-num54.5%
Applied egg-rr54.5%
Taylor expanded in x around 0 86.3%
if -2.6e-64 < y < 5.5e-33Initial program 98.1%
Taylor expanded in y around 0 81.6%
Final simplification84.4%
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.9e-64) 1.0 (if (<= y 5.5e-34) (- 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 <= -3.9e-64) {
tmp = 1.0;
} else if (y <= 5.5e-34) {
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 <= (-3.9d-64)) then
tmp = 1.0d0
else if (y <= 5.5d-34) 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 <= -3.9e-64) {
tmp = 1.0;
} else if (y <= 5.5e-34) {
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 <= -3.9e-64: tmp = 1.0 elif y <= 5.5e-34: 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 <= -3.9e-64) tmp = 1.0; elseif (y <= 5.5e-34) tmp = Float64(1.0 - Float64(Float64(x / 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.9e-64)
tmp = 1.0;
elseif (y <= 5.5e-34)
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, -3.9e-64], 1.0, If[LessEqual[y, 5.5e-34], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $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.9 \cdot 10^{-64}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-34}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.8999999999999997e-64 or 5.50000000000000014e-34 < y Initial program 99.9%
Taylor expanded in y around 0 55.9%
associate-/r*55.9%
div-inv55.9%
Applied egg-rr55.9%
*-commutative55.9%
frac-2neg55.9%
associate-*r/55.9%
add-sqr-sqrt27.3%
sqrt-unprod55.2%
sqr-neg55.2%
sqrt-unprod27.5%
add-sqr-sqrt54.5%
associate-/r/54.5%
clear-num54.5%
Applied egg-rr54.5%
Taylor expanded in x around 0 86.3%
if -3.8999999999999997e-64 < y < 5.50000000000000014e-34Initial program 98.1%
clear-num98.0%
inv-pow98.0%
associate-/l*97.4%
Applied egg-rr97.4%
Taylor expanded in y around 0 81.6%
*-commutative81.6%
associate-/r*81.7%
Simplified81.7%
Final simplification84.4%
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 -9e-43) (- 1.0 (/ x (* z (- t y)))) (+ 1.0 (/ 1.0 (* (/ y x) (- t y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e-43) {
tmp = 1.0 - (x / (z * (t - y)));
} else {
tmp = 1.0 + (1.0 / ((y / x) * (t - y)));
}
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 <= (-9d-43)) then
tmp = 1.0d0 - (x / (z * (t - y)))
else
tmp = 1.0d0 + (1.0d0 / ((y / x) * (t - y)))
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 <= -9e-43) {
tmp = 1.0 - (x / (z * (t - y)));
} else {
tmp = 1.0 + (1.0 / ((y / x) * (t - y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -9e-43: tmp = 1.0 - (x / (z * (t - y))) else: tmp = 1.0 + (1.0 / ((y / x) * (t - y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -9e-43) tmp = Float64(1.0 - Float64(x / Float64(z * Float64(t - y)))); else tmp = Float64(1.0 + Float64(1.0 / Float64(Float64(y / x) * Float64(t - y)))); 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 <= -9e-43)
tmp = 1.0 - (x / (z * (t - y)));
else
tmp = 1.0 + (1.0 / ((y / x) * (t - y)));
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, -9e-43], N[(1.0 - N[(x / N[(z * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(1.0 / N[(N[(y / x), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-43}:\\
\;\;\;\;1 - \frac{x}{z \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{1}{\frac{y}{x} \cdot \left(t - y\right)}\\
\end{array}
\end{array}
if z < -9.0000000000000005e-43Initial program 99.9%
Taylor expanded in z around inf 96.3%
associate-*r/96.3%
neg-mul-196.3%
*-commutative96.3%
Simplified96.3%
if -9.0000000000000005e-43 < z Initial program 98.8%
Taylor expanded in z around 0 78.2%
associate-/r*78.8%
Simplified78.8%
clear-num78.8%
inv-pow78.8%
div-inv78.8%
clear-num78.8%
Applied egg-rr78.8%
unpow-178.8%
Simplified78.8%
Final simplification84.3%
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 -4e-43) (- 1.0 (/ x (* z (- t y)))) (+ 1.0 (/ x (* y (- t y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e-43) {
tmp = 1.0 - (x / (z * (t - y)));
} else {
tmp = 1.0 + (x / (y * (t - y)));
}
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 <= (-4d-43)) then
tmp = 1.0d0 - (x / (z * (t - y)))
else
tmp = 1.0d0 + (x / (y * (t - y)))
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 <= -4e-43) {
tmp = 1.0 - (x / (z * (t - y)));
} else {
tmp = 1.0 + (x / (y * (t - y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -4e-43: tmp = 1.0 - (x / (z * (t - y))) else: tmp = 1.0 + (x / (y * (t - y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -4e-43) tmp = Float64(1.0 - Float64(x / Float64(z * Float64(t - y)))); else tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); 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 <= -4e-43)
tmp = 1.0 - (x / (z * (t - y)));
else
tmp = 1.0 + (x / (y * (t - y)));
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, -4e-43], N[(1.0 - N[(x / N[(z * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-43}:\\
\;\;\;\;1 - \frac{x}{z \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\end{array}
\end{array}
if z < -4.00000000000000031e-43Initial program 99.9%
Taylor expanded in z around inf 96.3%
associate-*r/96.3%
neg-mul-196.3%
*-commutative96.3%
Simplified96.3%
if -4.00000000000000031e-43 < z Initial program 98.8%
Taylor expanded in z around 0 78.2%
Final simplification83.9%
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 z)) (/ (- t 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 - z)) / ((t - 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 - z)) / ((t - 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 - z)) / ((t - y) / x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((1.0 / (y - z)) / ((t - y) / 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(y - z)) / Float64(Float64(t - 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 - z)) / ((t - 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[(N[(1.0 / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(N[(t - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{1}{y - z}}{\frac{t - y}{x}}
\end{array}
Initial program 99.2%
clear-num99.1%
inv-pow99.1%
associate-/l*98.9%
Applied egg-rr98.9%
unpow-198.9%
associate-/r*98.9%
Applied egg-rr98.9%
Final simplification98.9%
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) (- t y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - z) * (t - y)));
}
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) * (t - y)))
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 - y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (x / ((y - z) * (t - y)))
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(t - y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (x / ((y - z) * (t - y)));
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[(t - y), $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(t - y\right)}
\end{array}
Initial program 99.2%
Final simplification99.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)) (- z y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - t)) / (z - y));
}
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)) / (z - y))
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)) / (z - y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((x / (y - t)) / (z - y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(y - t)) / Float64(z - y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (y - t)) / (z - y));
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[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{x}{y - t}}{z - y}
\end{array}
Initial program 99.2%
clear-num99.1%
inv-pow99.1%
associate-/l*98.9%
Applied egg-rr98.9%
unpow-198.9%
*-commutative98.9%
associate-/r*98.8%
clear-num98.8%
Applied egg-rr98.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 99.2%
Taylor expanded in y around 0 66.5%
associate-/r*66.2%
div-inv66.1%
Applied egg-rr66.1%
*-commutative66.1%
frac-2neg66.1%
associate-*r/66.5%
add-sqr-sqrt34.1%
sqrt-unprod57.4%
sqr-neg57.4%
sqrt-unprod26.4%
add-sqr-sqrt53.8%
associate-/r/53.8%
clear-num53.8%
Applied egg-rr53.8%
Taylor expanded in x around 0 72.4%
Final simplification72.4%
herbie shell --seed 2024074
(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)))))