
(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 9 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)) (/ (/ (- x) t) z) (if (<= (* z t) 5e+228) (/ x (fma z (- t) 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 * t) <= -((double) INFINITY)) {
tmp = (-x / t) / z;
} else if ((z * t) <= 5e+228) {
tmp = x / fma(z, -t, 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 (Float64(z * t) <= Float64(-Inf)) tmp = Float64(Float64(Float64(-x) / t) / z); elseif (Float64(z * t) <= 5e+228) tmp = Float64(x / fma(z, Float64(-t), y)); else tmp = Float64(Float64(x / Float64(-z)) / t); end return 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[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+228], N[(x / N[(z * (-t) + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / (-z)), $MachinePrecision] / t), $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{\frac{-x}{t}}{z}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+228}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{-z}}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 74.1%
Taylor expanded in y around 0 74.1%
mul-1-neg74.1%
associate-/r*99.9%
distribute-neg-frac99.9%
Simplified99.9%
if -inf.0 < (*.f64 z t) < 5e228Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-out99.9%
fma-def99.9%
Simplified99.9%
if 5e228 < (*.f64 z t) Initial program 82.5%
Taylor expanded in y around 0 82.5%
mul-1-neg82.5%
associate-/r*100.0%
distribute-neg-frac100.0%
Simplified100.0%
expm1-log1p-u99.9%
expm1-udef76.5%
add-sqr-sqrt50.7%
sqrt-unprod76.5%
sqr-neg76.5%
sqrt-unprod50.9%
add-sqr-sqrt72.5%
Applied egg-rr72.5%
expm1-def72.0%
expm1-log1p72.0%
associate-/r*72.3%
Simplified72.3%
add-sqr-sqrt27.8%
sqrt-unprod75.6%
sqr-neg75.6%
sqrt-unprod54.5%
add-sqr-sqrt82.5%
neg-mul-182.5%
times-frac99.8%
Applied egg-rr99.8%
frac-times82.5%
*-commutative82.5%
frac-times99.9%
clear-num99.9%
frac-times82.5%
*-commutative82.5%
*-un-lft-identity82.5%
div-inv82.5%
metadata-eval82.5%
Applied egg-rr82.5%
*-commutative82.5%
neg-mul-182.5%
associate-/l/99.9%
Simplified99.9%
Final simplification99.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 (<= (* z t) (- INFINITY)) (/ (/ (- x) t) z) (if (<= (* z t) 5e+228) (/ x (- y (* z t))) (/ (/ x (- z)) t))))
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 = (-x / t) / z;
} else if ((z * t) <= 5e+228) {
tmp = x / (y - (z * t));
} else {
tmp = (x / -z) / t;
}
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 = (-x / t) / z;
} else if ((z * t) <= 5e+228) {
tmp = x / (y - (z * t));
} 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 * t) <= -math.inf: tmp = (-x / t) / z elif (z * t) <= 5e+228: tmp = x / (y - (z * t)) 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 (Float64(z * t) <= Float64(-Inf)) tmp = Float64(Float64(Float64(-x) / t) / z); elseif (Float64(z * t) <= 5e+228) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(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 * t) <= -Inf)
tmp = (-x / t) / z;
elseif ((z * t) <= 5e+228)
tmp = x / (y - (z * t));
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[N[(z * t), $MachinePrecision], (-Infinity)], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+228], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / (-z)), $MachinePrecision] / t), $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{\frac{-x}{t}}{z}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+228}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{-z}}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 74.1%
Taylor expanded in y around 0 74.1%
mul-1-neg74.1%
associate-/r*99.9%
distribute-neg-frac99.9%
Simplified99.9%
if -inf.0 < (*.f64 z t) < 5e228Initial program 99.9%
if 5e228 < (*.f64 z t) Initial program 82.5%
Taylor expanded in y around 0 82.5%
mul-1-neg82.5%
associate-/r*100.0%
distribute-neg-frac100.0%
Simplified100.0%
expm1-log1p-u99.9%
expm1-udef76.5%
add-sqr-sqrt50.7%
sqrt-unprod76.5%
sqr-neg76.5%
sqrt-unprod50.9%
add-sqr-sqrt72.5%
Applied egg-rr72.5%
expm1-def72.0%
expm1-log1p72.0%
associate-/r*72.3%
Simplified72.3%
add-sqr-sqrt27.8%
sqrt-unprod75.6%
sqr-neg75.6%
sqrt-unprod54.5%
add-sqr-sqrt82.5%
neg-mul-182.5%
times-frac99.8%
Applied egg-rr99.8%
frac-times82.5%
*-commutative82.5%
frac-times99.9%
clear-num99.9%
frac-times82.5%
*-commutative82.5%
*-un-lft-identity82.5%
div-inv82.5%
metadata-eval82.5%
Applied egg-rr82.5%
*-commutative82.5%
neg-mul-182.5%
associate-/l/99.9%
Simplified99.9%
Final simplification99.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 (<= t -8.5e-77) (/ (/ x (- z)) t) (if (<= t 27000.0) (/ x y) (/ -1.0 (* z (/ t x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.5e-77) {
tmp = (x / -z) / t;
} else if (t <= 27000.0) {
tmp = x / y;
} else {
tmp = -1.0 / (z * (t / x));
}
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 <= (-8.5d-77)) then
tmp = (x / -z) / t
else if (t <= 27000.0d0) then
tmp = x / y
else
tmp = (-1.0d0) / (z * (t / x))
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 <= -8.5e-77) {
tmp = (x / -z) / t;
} else if (t <= 27000.0) {
tmp = x / y;
} else {
tmp = -1.0 / (z * (t / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= -8.5e-77: tmp = (x / -z) / t elif t <= 27000.0: tmp = x / y else: tmp = -1.0 / (z * (t / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -8.5e-77) tmp = Float64(Float64(x / Float64(-z)) / t); elseif (t <= 27000.0) tmp = Float64(x / y); else tmp = Float64(-1.0 / Float64(z * Float64(t / x))); 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 <= -8.5e-77)
tmp = (x / -z) / t;
elseif (t <= 27000.0)
tmp = x / y;
else
tmp = -1.0 / (z * (t / x));
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, -8.5e-77], N[(N[(x / (-z)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 27000.0], N[(x / y), $MachinePrecision], N[(-1.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{-77}:\\
\;\;\;\;\frac{\frac{x}{-z}}{t}\\
\mathbf{elif}\;t \leq 27000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{z \cdot \frac{t}{x}}\\
\end{array}
\end{array}
if t < -8.4999999999999998e-77Initial program 93.5%
Taylor expanded in y around 0 59.6%
mul-1-neg59.6%
associate-/r*66.1%
distribute-neg-frac66.1%
Simplified66.1%
expm1-log1p-u57.7%
expm1-udef38.2%
add-sqr-sqrt25.3%
sqrt-unprod30.1%
sqr-neg30.1%
sqrt-unprod21.0%
add-sqr-sqrt28.8%
Applied egg-rr28.8%
expm1-def25.9%
expm1-log1p27.6%
associate-/r*25.5%
Simplified25.5%
add-sqr-sqrt10.4%
sqrt-unprod40.0%
sqr-neg40.0%
sqrt-unprod32.7%
add-sqr-sqrt59.6%
neg-mul-159.6%
times-frac62.4%
Applied egg-rr62.4%
frac-times59.6%
*-commutative59.6%
frac-times66.1%
clear-num66.1%
frac-times59.6%
*-commutative59.6%
*-un-lft-identity59.6%
div-inv59.6%
metadata-eval59.6%
Applied egg-rr59.6%
*-commutative59.6%
neg-mul-159.6%
associate-/l/62.5%
Simplified62.5%
if -8.4999999999999998e-77 < t < 27000Initial program 99.9%
Taylor expanded in y around inf 76.2%
if 27000 < t Initial program 94.4%
Taylor expanded in y around 0 76.9%
mul-1-neg76.9%
associate-/r*81.4%
distribute-neg-frac81.4%
Simplified81.4%
expm1-log1p-u70.5%
expm1-udef50.7%
add-sqr-sqrt35.3%
sqrt-unprod45.2%
sqr-neg45.2%
sqrt-unprod28.4%
add-sqr-sqrt43.7%
Applied egg-rr43.7%
expm1-def41.9%
expm1-log1p42.0%
associate-/r*40.5%
Simplified40.5%
add-sqr-sqrt16.0%
sqrt-unprod51.5%
sqr-neg51.5%
sqrt-unprod43.3%
add-sqr-sqrt76.9%
neg-mul-176.9%
times-frac73.8%
Applied egg-rr73.8%
frac-times76.9%
*-commutative76.9%
frac-times81.4%
clear-num82.8%
frac-times82.0%
metadata-eval82.0%
Applied egg-rr82.0%
Final simplification73.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 (or (<= t -5.2e-77) (not (<= t 27500.0))) (/ (- x) (* z t)) (/ x y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-77) || !(t <= 27500.0)) {
tmp = -x / (z * t);
} 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.2d-77)) .or. (.not. (t <= 27500.0d0))) then
tmp = -x / (z * t)
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.2e-77) || !(t <= 27500.0)) {
tmp = -x / (z * t);
} 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.2e-77) or not (t <= 27500.0): tmp = -x / (z * t) 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.2e-77) || !(t <= 27500.0)) tmp = Float64(Float64(-x) / Float64(z * t)); 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.2e-77) || ~((t <= 27500.0)))
tmp = -x / (z * t);
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.2e-77], N[Not[LessEqual[t, 27500.0]], $MachinePrecision]], N[((-x) / N[(z * t), $MachinePrecision]), $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.2 \cdot 10^{-77} \lor \neg \left(t \leq 27500\right):\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -5.2000000000000002e-77 or 27500 < t Initial program 93.9%
Taylor expanded in y around 0 67.4%
associate-*r/67.4%
neg-mul-167.4%
Simplified67.4%
if -5.2000000000000002e-77 < t < 27500Initial program 99.9%
Taylor expanded in y around inf 76.2%
Final simplification71.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 (or (<= t -4.3e-77) (not (<= t 27500.0))) (/ (/ (- 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 <= -4.3e-77) || !(t <= 27500.0)) {
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 <= (-4.3d-77)) .or. (.not. (t <= 27500.0d0))) 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 <= -4.3e-77) || !(t <= 27500.0)) {
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 <= -4.3e-77) or not (t <= 27500.0): 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 <= -4.3e-77) || !(t <= 27500.0)) tmp = Float64(Float64(Float64(-x) / t) / 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 <= -4.3e-77) || ~((t <= 27500.0)))
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, -4.3e-77], N[Not[LessEqual[t, 27500.0]], $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 -4.3 \cdot 10^{-77} \lor \neg \left(t \leq 27500\right):\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -4.3000000000000002e-77 or 27500 < t Initial program 93.9%
Taylor expanded in y around 0 67.4%
mul-1-neg67.4%
associate-/r*73.1%
distribute-neg-frac73.1%
Simplified73.1%
if -4.3000000000000002e-77 < t < 27500Initial program 99.9%
Taylor expanded in y around inf 76.2%
Final simplification74.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 (<= t -9.5e-77) (/ (/ x (- z)) t) (if (<= t 27000.0) (/ 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 <= -9.5e-77) {
tmp = (x / -z) / t;
} else if (t <= 27000.0) {
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 <= (-9.5d-77)) then
tmp = (x / -z) / t
else if (t <= 27000.0d0) 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 <= -9.5e-77) {
tmp = (x / -z) / t;
} else if (t <= 27000.0) {
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 <= -9.5e-77: tmp = (x / -z) / t elif t <= 27000.0: 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 <= -9.5e-77) tmp = Float64(Float64(x / Float64(-z)) / t); elseif (t <= 27000.0) tmp = Float64(x / y); else tmp = Float64(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 <= -9.5e-77)
tmp = (x / -z) / t;
elseif (t <= 27000.0)
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, -9.5e-77], N[(N[(x / (-z)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 27000.0], 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 -9.5 \cdot 10^{-77}:\\
\;\;\;\;\frac{\frac{x}{-z}}{t}\\
\mathbf{elif}\;t \leq 27000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\end{array}
\end{array}
if t < -9.5000000000000005e-77Initial program 93.5%
Taylor expanded in y around 0 59.6%
mul-1-neg59.6%
associate-/r*66.1%
distribute-neg-frac66.1%
Simplified66.1%
expm1-log1p-u57.7%
expm1-udef38.2%
add-sqr-sqrt25.3%
sqrt-unprod30.1%
sqr-neg30.1%
sqrt-unprod21.0%
add-sqr-sqrt28.8%
Applied egg-rr28.8%
expm1-def25.9%
expm1-log1p27.6%
associate-/r*25.5%
Simplified25.5%
add-sqr-sqrt10.4%
sqrt-unprod40.0%
sqr-neg40.0%
sqrt-unprod32.7%
add-sqr-sqrt59.6%
neg-mul-159.6%
times-frac62.4%
Applied egg-rr62.4%
frac-times59.6%
*-commutative59.6%
frac-times66.1%
clear-num66.1%
frac-times59.6%
*-commutative59.6%
*-un-lft-identity59.6%
div-inv59.6%
metadata-eval59.6%
Applied egg-rr59.6%
*-commutative59.6%
neg-mul-159.6%
associate-/l/62.5%
Simplified62.5%
if -9.5000000000000005e-77 < t < 27000Initial program 99.9%
Taylor expanded in y around inf 76.2%
if 27000 < t Initial program 94.4%
Taylor expanded in y around 0 76.9%
mul-1-neg76.9%
associate-/r*81.4%
distribute-neg-frac81.4%
Simplified81.4%
Final simplification73.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 (or (<= t -1.25e+36) (not (<= t 2.8e+174))) (/ x (* z t)) (/ x y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.25e+36) || !(t <= 2.8e+174)) {
tmp = x / (z * t);
} 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 <= (-1.25d+36)) .or. (.not. (t <= 2.8d+174))) then
tmp = x / (z * t)
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 <= -1.25e+36) || !(t <= 2.8e+174)) {
tmp = x / (z * t);
} 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 <= -1.25e+36) or not (t <= 2.8e+174): tmp = x / (z * t) 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 <= -1.25e+36) || !(t <= 2.8e+174)) tmp = Float64(x / Float64(z * t)); 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 <= -1.25e+36) || ~((t <= 2.8e+174)))
tmp = x / (z * t);
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, -1.25e+36], N[Not[LessEqual[t, 2.8e+174]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $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 -1.25 \cdot 10^{+36} \lor \neg \left(t \leq 2.8 \cdot 10^{+174}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -1.24999999999999994e36 or 2.7999999999999999e174 < t Initial program 90.5%
Taylor expanded in y around 0 68.1%
mul-1-neg68.1%
associate-/r*76.9%
distribute-neg-frac76.9%
Simplified76.9%
expm1-log1p-u68.8%
expm1-udef47.2%
add-sqr-sqrt36.0%
sqrt-unprod43.4%
sqr-neg43.4%
sqrt-unprod30.5%
add-sqr-sqrt42.4%
Applied egg-rr42.4%
expm1-def40.0%
expm1-log1p41.3%
associate-/r*38.4%
Simplified38.4%
if -1.24999999999999994e36 < t < 2.7999999999999999e174Initial program 99.9%
Taylor expanded in y around inf 64.5%
Final simplification55.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 -7.5e+35) (/ x (* z t)) (if (<= t 2.05e+175) (/ 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 <= -7.5e+35) {
tmp = x / (z * t);
} else if (t <= 2.05e+175) {
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 <= (-7.5d+35)) then
tmp = x / (z * t)
else if (t <= 2.05d+175) 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 <= -7.5e+35) {
tmp = x / (z * t);
} else if (t <= 2.05e+175) {
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 <= -7.5e+35: tmp = x / (z * t) elif t <= 2.05e+175: 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 <= -7.5e+35) tmp = Float64(x / Float64(z * t)); elseif (t <= 2.05e+175) 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 <= -7.5e+35)
tmp = x / (z * t);
elseif (t <= 2.05e+175)
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, -7.5e+35], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.05e+175], 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 -7.5 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{+175}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if t < -7.4999999999999999e35Initial program 91.0%
Taylor expanded in y around 0 63.2%
mul-1-neg63.2%
associate-/r*72.4%
distribute-neg-frac72.4%
Simplified72.4%
expm1-log1p-u64.9%
expm1-udef42.5%
add-sqr-sqrt29.7%
sqrt-unprod39.5%
sqr-neg39.5%
sqrt-unprod27.6%
add-sqr-sqrt37.8%
Applied egg-rr37.8%
expm1-def34.1%
expm1-log1p36.0%
associate-/r*33.1%
Simplified33.1%
if -7.4999999999999999e35 < t < 2.04999999999999989e175Initial program 99.9%
Taylor expanded in y around inf 64.5%
if 2.04999999999999989e175 < t Initial program 89.8%
Taylor expanded in y around 0 75.9%
mul-1-neg75.9%
associate-/r*84.1%
distribute-neg-frac84.1%
Simplified84.1%
expm1-log1p-u75.1%
expm1-udef54.9%
add-sqr-sqrt46.2%
sqrt-unprod49.8%
sqr-neg49.8%
sqrt-unprod35.2%
add-sqr-sqrt49.9%
Applied egg-rr49.9%
expm1-def49.6%
expm1-log1p49.7%
associate-/r*47.0%
Simplified47.0%
add-sqr-sqrt17.6%
sqrt-unprod54.5%
sqr-neg54.5%
sqrt-unprod44.3%
add-sqr-sqrt75.9%
neg-mul-175.9%
times-frac75.3%
Applied egg-rr75.3%
*-commutative75.3%
associate-*l/84.1%
frac-2neg84.1%
metadata-eval84.1%
div-inv84.1%
add-sqr-sqrt0.0%
sqrt-unprod50.3%
sqr-neg50.3%
sqrt-unprod49.7%
add-sqr-sqrt49.7%
Applied egg-rr49.7%
Final simplification55.3%
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 96.4%
Taylor expanded in y around inf 53.1%
Final simplification53.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 2024010
(FPCore (x y z t)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(if (< x -1.618195973607049e+50) (/ 1.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))
(/ x (- y (* z t))))