
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * 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 = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * 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 = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\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 (<= (* z t) (- INFINITY)) (/ -1.0 (* t (/ z x))) (if (<= (* z t) 2e+238) (/ x (- y (* z t))) (/ (/ x t) (- z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = -1.0 / (t * (z / x));
} else if ((z * t) <= 2e+238) {
tmp = x / (y - (z * t));
} else {
tmp = (x / t) / -z;
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = -1.0 / (t * (z / x));
} else if ((z * t) <= 2e+238) {
tmp = x / (y - (z * t));
} else {
tmp = (x / t) / -z;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (z * t) <= -math.inf: tmp = -1.0 / (t * (z / x)) elif (z * t) <= 2e+238: tmp = x / (y - (z * t)) else: tmp = (x / t) / -z return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = Float64(-1.0 / Float64(t * Float64(z / x))); elseif (Float64(z * t) <= 2e+238) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(Float64(x / t) / Float64(-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 ((z * t) <= -Inf)
tmp = -1.0 / (t * (z / x));
elseif ((z * t) <= 2e+238)
tmp = x / (y - (z * t));
else
tmp = (x / t) / -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[N[(z * t), $MachinePrecision], (-Infinity)], N[(-1.0 / N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+238], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{-1}{t \cdot \frac{z}{x}}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+238}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 56.0%
Taylor expanded in t around -inf 84.3%
Taylor expanded in z around inf 99.5%
clear-num99.9%
un-div-inv99.9%
div-inv99.8%
clear-num99.9%
Applied egg-rr99.9%
if -inf.0 < (*.f64 z t) < 2.0000000000000001e238Initial program 99.9%
if 2.0000000000000001e238 < (*.f64 z t) Initial program 65.0%
clear-num65.0%
associate-/r/65.0%
Applied egg-rr65.0%
Taylor expanded in y around 0 65.0%
mul-1-neg65.0%
associate-/r*99.8%
distribute-neg-frac299.8%
Simplified99.8%
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 (<= t -5.8e-24) (not (<= t 3.1e+60))) (/ (/ x t) (- z)) (/ x y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.8e-24) || !(t <= 3.1e+60)) {
tmp = (x / t) / -z;
} else {
tmp = x / 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 ((t <= (-5.8d-24)) .or. (.not. (t <= 3.1d+60))) then
tmp = (x / t) / -z
else
tmp = x / 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 ((t <= -5.8e-24) || !(t <= 3.1e+60)) {
tmp = (x / t) / -z;
} else {
tmp = x / y;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (t <= -5.8e-24) or not (t <= 3.1e+60): tmp = (x / t) / -z else: tmp = x / y return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((t <= -5.8e-24) || !(t <= 3.1e+60)) tmp = Float64(Float64(x / t) / Float64(-z)); else tmp = Float64(x / 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 ((t <= -5.8e-24) || ~((t <= 3.1e+60)))
tmp = (x / t) / -z;
else
tmp = x / 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[Or[LessEqual[t, -5.8e-24], N[Not[LessEqual[t, 3.1e+60]], $MachinePrecision]], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{-24} \lor \neg \left(t \leq 3.1 \cdot 10^{+60}\right):\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -5.7999999999999997e-24 or 3.1000000000000001e60 < t Initial program 87.1%
clear-num85.9%
associate-/r/87.0%
Applied egg-rr87.0%
Taylor expanded in y around 0 59.2%
mul-1-neg59.2%
associate-/r*72.0%
distribute-neg-frac272.0%
Simplified72.0%
if -5.7999999999999997e-24 < t < 3.1000000000000001e60Initial program 99.5%
Taylor expanded in y around inf 71.3%
Final simplification71.6%
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 -1e+64) (/ -1.0 (* t (/ z x))) (if (<= z 1.06e-128) (/ x y) (/ (/ x t) (- z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e+64) {
tmp = -1.0 / (t * (z / x));
} else if (z <= 1.06e-128) {
tmp = x / y;
} else {
tmp = (x / t) / -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 (z <= (-1d+64)) then
tmp = (-1.0d0) / (t * (z / x))
else if (z <= 1.06d-128) then
tmp = x / y
else
tmp = (x / t) / -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 (z <= -1e+64) {
tmp = -1.0 / (t * (z / x));
} else if (z <= 1.06e-128) {
tmp = x / y;
} else {
tmp = (x / t) / -z;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -1e+64: tmp = -1.0 / (t * (z / x)) elif z <= 1.06e-128: tmp = x / y else: tmp = (x / t) / -z return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1e+64) tmp = Float64(-1.0 / Float64(t * Float64(z / x))); elseif (z <= 1.06e-128) tmp = Float64(x / y); else tmp = Float64(Float64(x / t) / Float64(-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 (z <= -1e+64)
tmp = -1.0 / (t * (z / x));
elseif (z <= 1.06e-128)
tmp = x / y;
else
tmp = (x / t) / -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[z, -1e+64], N[(-1.0 / N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.06e-128], N[(x / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+64}:\\
\;\;\;\;\frac{-1}{t \cdot \frac{z}{x}}\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-128}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\end{array}
\end{array}
if z < -1.00000000000000002e64Initial program 87.5%
Taylor expanded in t around -inf 67.1%
Taylor expanded in z around inf 74.4%
clear-num74.5%
un-div-inv74.5%
div-inv76.1%
clear-num76.2%
Applied egg-rr76.2%
if -1.00000000000000002e64 < z < 1.05999999999999995e-128Initial program 99.9%
Taylor expanded in y around inf 78.2%
if 1.05999999999999995e-128 < z Initial program 91.3%
clear-num90.8%
associate-/r/91.3%
Applied egg-rr91.3%
Taylor expanded in y around 0 59.0%
mul-1-neg59.0%
associate-/r*64.5%
distribute-neg-frac264.5%
Simplified64.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 -1e+64) (/ (/ x (- z)) t) (if (<= z 1.06e-128) (/ x y) (/ (/ x t) (- z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e+64) {
tmp = (x / -z) / t;
} else if (z <= 1.06e-128) {
tmp = x / y;
} else {
tmp = (x / t) / -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 (z <= (-1d+64)) then
tmp = (x / -z) / t
else if (z <= 1.06d-128) then
tmp = x / y
else
tmp = (x / t) / -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 (z <= -1e+64) {
tmp = (x / -z) / t;
} else if (z <= 1.06e-128) {
tmp = x / y;
} else {
tmp = (x / t) / -z;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -1e+64: tmp = (x / -z) / t elif z <= 1.06e-128: tmp = x / y else: tmp = (x / t) / -z return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1e+64) tmp = Float64(Float64(x / Float64(-z)) / t); elseif (z <= 1.06e-128) tmp = Float64(x / y); else tmp = Float64(Float64(x / t) / Float64(-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 (z <= -1e+64)
tmp = (x / -z) / t;
elseif (z <= 1.06e-128)
tmp = x / y;
else
tmp = (x / t) / -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[z, -1e+64], N[(N[(x / (-z)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.06e-128], N[(x / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+64}:\\
\;\;\;\;\frac{\frac{x}{-z}}{t}\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-128}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\end{array}
\end{array}
if z < -1.00000000000000002e64Initial program 87.5%
Taylor expanded in t around -inf 67.1%
Taylor expanded in z around inf 74.4%
mul-1-neg74.4%
distribute-neg-frac274.4%
Applied egg-rr74.4%
if -1.00000000000000002e64 < z < 1.05999999999999995e-128Initial program 99.9%
Taylor expanded in y around inf 78.2%
if 1.05999999999999995e-128 < z Initial program 91.3%
clear-num90.8%
associate-/r/91.3%
Applied egg-rr91.3%
Taylor expanded in y around 0 59.0%
mul-1-neg59.0%
associate-/r*64.5%
distribute-neg-frac264.5%
Simplified64.5%
Final simplification72.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 (<= y -4e+38) (/ 1.0 (/ y x)) (if (<= y 3.5e-57) (/ x (* t (- z))) (/ x y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4e+38) {
tmp = 1.0 / (y / x);
} else if (y <= 3.5e-57) {
tmp = x / (t * -z);
} else {
tmp = x / 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 (y <= (-4d+38)) then
tmp = 1.0d0 / (y / x)
else if (y <= 3.5d-57) then
tmp = x / (t * -z)
else
tmp = x / 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 (y <= -4e+38) {
tmp = 1.0 / (y / x);
} else if (y <= 3.5e-57) {
tmp = x / (t * -z);
} else {
tmp = x / y;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -4e+38: tmp = 1.0 / (y / x) elif y <= 3.5e-57: tmp = x / (t * -z) else: tmp = x / y return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -4e+38) tmp = Float64(1.0 / Float64(y / x)); elseif (y <= 3.5e-57) tmp = Float64(x / Float64(t * Float64(-z))); else tmp = Float64(x / 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 (y <= -4e+38)
tmp = 1.0 / (y / x);
elseif (y <= 3.5e-57)
tmp = x / (t * -z);
else
tmp = x / 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[y, -4e+38], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e-57], N[(x / N[(t * (-z)), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+38}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-57}:\\
\;\;\;\;\frac{x}{t \cdot \left(-z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < -3.99999999999999991e38Initial program 95.6%
Taylor expanded in y around inf 84.4%
clear-num85.6%
inv-pow85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
if -3.99999999999999991e38 < y < 3.49999999999999991e-57Initial program 93.0%
Taylor expanded in y around 0 71.6%
associate-*r/71.6%
neg-mul-171.6%
Simplified71.6%
if 3.49999999999999991e-57 < y Initial program 94.9%
Taylor expanded in y around inf 76.7%
Final simplification75.8%
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.9e+172) (/ x y) (/ (/ x t) z)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.9e+172) {
tmp = x / y;
} else {
tmp = (x / t) / 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 <= 1.9d+172) then
tmp = x / y
else
tmp = (x / t) / 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 <= 1.9e+172) {
tmp = x / y;
} else {
tmp = (x / t) / z;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 1.9e+172: tmp = x / y else: tmp = (x / t) / z return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 1.9e+172) tmp = Float64(x / y); else tmp = Float64(Float64(x / t) / 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 <= 1.9e+172)
tmp = x / y;
else
tmp = (x / t) / 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, 1.9e+172], N[(x / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.9 \cdot 10^{+172}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if t < 1.89999999999999985e172Initial program 94.8%
Taylor expanded in y around inf 58.3%
if 1.89999999999999985e172 < t Initial program 86.5%
Taylor expanded in t around -inf 62.1%
Taylor expanded in z around inf 77.0%
associate-/l/68.0%
associate-*r/68.0%
neg-mul-168.0%
add-sqr-sqrt33.6%
sqrt-unprod58.6%
sqr-neg58.6%
sqrt-unprod29.3%
add-sqr-sqrt49.3%
associate-/r*49.3%
Applied egg-rr49.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 5e-45) (/ x y) (/ x (* z t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 5e-45) {
tmp = x / y;
} else {
tmp = 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 (z <= 5d-45) then
tmp = x / y
else
tmp = 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 (z <= 5e-45) {
tmp = x / y;
} else {
tmp = x / (z * t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 5e-45: tmp = x / y else: tmp = x / (z * t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 5e-45) tmp = Float64(x / y); else tmp = Float64(x / Float64(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 <= 5e-45)
tmp = x / y;
else
tmp = 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[LessEqual[z, 5e-45], N[(x / y), $MachinePrecision], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5 \cdot 10^{-45}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot t}\\
\end{array}
\end{array}
if z < 4.99999999999999976e-45Initial program 96.1%
Taylor expanded in y around inf 65.7%
if 4.99999999999999976e-45 < z Initial program 89.7%
Taylor expanded in y around 0 63.5%
associate-*r/63.5%
neg-mul-163.5%
Simplified63.5%
neg-sub063.5%
sub-neg63.5%
add-sqr-sqrt29.6%
sqrt-unprod46.8%
sqr-neg46.8%
sqrt-unprod16.4%
add-sqr-sqrt27.6%
Applied egg-rr27.6%
+-lft-identity27.6%
Simplified27.6%
Final simplification53.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ x y))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return x / 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 = x / y
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return x / y;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return x / y
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(x / y) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = x / y;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{x}{y}
\end{array}
Initial program 94.1%
Taylor expanded in y around inf 56.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 1.0 (- (/ y x) (* (/ z x) t)))))
(if (< x -1.618195973607049e+50)
t_1
(if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / ((y / x) - ((z / x) * t));
double tmp;
if (x < -1.618195973607049e+50) {
tmp = t_1;
} else if (x < 2.1378306434876444e+131) {
tmp = x / (y - (z * t));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 / ((y / x) - ((z / x) * t))
if (x < (-1.618195973607049d+50)) then
tmp = t_1
else if (x < 2.1378306434876444d+131) then
tmp = x / (y - (z * t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 / ((y / x) - ((z / x) * t));
double tmp;
if (x < -1.618195973607049e+50) {
tmp = t_1;
} else if (x < 2.1378306434876444e+131) {
tmp = x / (y - (z * t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 / ((y / x) - ((z / x) * t)) tmp = 0 if x < -1.618195973607049e+50: tmp = t_1 elif x < 2.1378306434876444e+131: tmp = x / (y - (z * t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 / Float64(Float64(y / x) - Float64(Float64(z / x) * t))) tmp = 0.0 if (x < -1.618195973607049e+50) tmp = t_1; elseif (x < 2.1378306434876444e+131) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 / ((y / x) - ((z / x) * t)); tmp = 0.0; if (x < -1.618195973607049e+50) tmp = t_1; elseif (x < 2.1378306434876444e+131) tmp = x / (y - (z * t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[(y / x), $MachinePrecision] - N[(N[(z / x), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[x, -1.618195973607049e+50], t$95$1, If[Less[x, 2.1378306434876444e+131], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\
\mathbf{if}\;x < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x < 2.1378306434876444 \cdot 10^{+131}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024144
(FPCore (x y z t)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:alt
(! :herbie-platform default (if (< x -161819597360704900000000000000000000000000000000000) (/ 1 (- (/ y x) (* (/ z x) t))) (if (< x 213783064348764440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ x (- y (* z t))) (/ 1 (- (/ y x) (* (/ z x) t))))))
(/ x (- y (* z t))))