
(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: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 2e+200))) (- (/ (/ x t) z)) (/ x (fma z (- t) y))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -((double) INFINITY)) || !((z * t) <= 2e+200)) {
tmp = -((x / t) / z);
} else {
tmp = x / fma(z, -t, y);
}
return tmp;
}
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((Float64(z * t) <= Float64(-Inf)) || !(Float64(z * t) <= 2e+200)) tmp = Float64(-Float64(Float64(x / t) / z)); else tmp = Float64(x / fma(z, Float64(-t), y)); end return tmp end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+200]], $MachinePrecision]], (-N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), N[(x / N[(z * (-t) + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+200}\right):\\
\;\;\;\;-\frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 1.9999999999999999e200 < (*.f64 z t) Initial program 76.4%
Taylor expanded in y around 0 76.4%
mul-1-neg76.4%
associate-/r*99.8%
distribute-neg-frac99.8%
Simplified99.8%
if -inf.0 < (*.f64 z t) < 1.9999999999999999e200Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-out99.8%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x) (* z t))) (t_2 (- (/ (/ x t) z))))
(if (<= (* z t) -1e+54)
t_2
(if (<= (* z t) -2e-34)
(/ x y)
(if (<= (* z t) -1e-61)
t_1
(if (<= (* z t) 5e-141)
(/ x y)
(if (<= (* z t) 5e-85)
t_1
(if (<= (* z t) 5e-55)
(/ x y)
(if (<= (* z t) 5e+76)
t_1
(if (<= (* z t) 2e+200) (/ x y) t_2))))))))))assert(z < t);
double code(double x, double y, double z, double t) {
double t_1 = -x / (z * t);
double t_2 = -((x / t) / z);
double tmp;
if ((z * t) <= -1e+54) {
tmp = t_2;
} else if ((z * t) <= -2e-34) {
tmp = x / y;
} else if ((z * t) <= -1e-61) {
tmp = t_1;
} else if ((z * t) <= 5e-141) {
tmp = x / y;
} else if ((z * t) <= 5e-85) {
tmp = t_1;
} else if ((z * t) <= 5e-55) {
tmp = x / y;
} else if ((z * t) <= 5e+76) {
tmp = t_1;
} else if ((z * t) <= 2e+200) {
tmp = x / y;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = -x / (z * t)
t_2 = -((x / t) / z)
if ((z * t) <= (-1d+54)) then
tmp = t_2
else if ((z * t) <= (-2d-34)) then
tmp = x / y
else if ((z * t) <= (-1d-61)) then
tmp = t_1
else if ((z * t) <= 5d-141) then
tmp = x / y
else if ((z * t) <= 5d-85) then
tmp = t_1
else if ((z * t) <= 5d-55) then
tmp = x / y
else if ((z * t) <= 5d+76) then
tmp = t_1
else if ((z * t) <= 2d+200) then
tmp = x / y
else
tmp = t_2
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = -x / (z * t);
double t_2 = -((x / t) / z);
double tmp;
if ((z * t) <= -1e+54) {
tmp = t_2;
} else if ((z * t) <= -2e-34) {
tmp = x / y;
} else if ((z * t) <= -1e-61) {
tmp = t_1;
} else if ((z * t) <= 5e-141) {
tmp = x / y;
} else if ((z * t) <= 5e-85) {
tmp = t_1;
} else if ((z * t) <= 5e-55) {
tmp = x / y;
} else if ((z * t) <= 5e+76) {
tmp = t_1;
} else if ((z * t) <= 2e+200) {
tmp = x / y;
} else {
tmp = t_2;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): t_1 = -x / (z * t) t_2 = -((x / t) / z) tmp = 0 if (z * t) <= -1e+54: tmp = t_2 elif (z * t) <= -2e-34: tmp = x / y elif (z * t) <= -1e-61: tmp = t_1 elif (z * t) <= 5e-141: tmp = x / y elif (z * t) <= 5e-85: tmp = t_1 elif (z * t) <= 5e-55: tmp = x / y elif (z * t) <= 5e+76: tmp = t_1 elif (z * t) <= 2e+200: tmp = x / y else: tmp = t_2 return tmp
z, t = sort([z, t]) function code(x, y, z, t) t_1 = Float64(Float64(-x) / Float64(z * t)) t_2 = Float64(-Float64(Float64(x / t) / z)) tmp = 0.0 if (Float64(z * t) <= -1e+54) tmp = t_2; elseif (Float64(z * t) <= -2e-34) tmp = Float64(x / y); elseif (Float64(z * t) <= -1e-61) tmp = t_1; elseif (Float64(z * t) <= 5e-141) tmp = Float64(x / y); elseif (Float64(z * t) <= 5e-85) tmp = t_1; elseif (Float64(z * t) <= 5e-55) tmp = Float64(x / y); elseif (Float64(z * t) <= 5e+76) tmp = t_1; elseif (Float64(z * t) <= 2e+200) tmp = Float64(x / y); else tmp = t_2; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = -x / (z * t);
t_2 = -((x / t) / z);
tmp = 0.0;
if ((z * t) <= -1e+54)
tmp = t_2;
elseif ((z * t) <= -2e-34)
tmp = x / y;
elseif ((z * t) <= -1e-61)
tmp = t_1;
elseif ((z * t) <= 5e-141)
tmp = x / y;
elseif ((z * t) <= 5e-85)
tmp = t_1;
elseif ((z * t) <= 5e-55)
tmp = x / y;
elseif ((z * t) <= 5e+76)
tmp = t_1;
elseif ((z * t) <= 2e+200)
tmp = x / y;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision])}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+54], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -2e-34], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-61], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-141], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-85], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-55], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+76], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e+200], N[(x / y), $MachinePrecision], t$95$2]]]]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{-x}{z \cdot t}\\
t_2 := -\frac{\frac{x}{t}}{z}\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+54}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-34}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-55}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+200}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 z t) < -1.0000000000000001e54 or 1.9999999999999999e200 < (*.f64 z t) Initial program 86.5%
Taylor expanded in y around 0 81.3%
mul-1-neg81.3%
associate-/r*90.6%
distribute-neg-frac90.6%
Simplified90.6%
if -1.0000000000000001e54 < (*.f64 z t) < -1.99999999999999986e-34 or -1e-61 < (*.f64 z t) < 4.9999999999999999e-141 or 5.0000000000000002e-85 < (*.f64 z t) < 5.0000000000000002e-55 or 4.99999999999999991e76 < (*.f64 z t) < 1.9999999999999999e200Initial program 99.9%
Taylor expanded in y around inf 84.2%
if -1.99999999999999986e-34 < (*.f64 z t) < -1e-61 or 4.9999999999999999e-141 < (*.f64 z t) < 5.0000000000000002e-85 or 5.0000000000000002e-55 < (*.f64 z t) < 4.99999999999999991e76Initial program 99.7%
Taylor expanded in y around 0 67.4%
associate-*r/67.4%
neg-mul-167.4%
Simplified67.4%
Final simplification83.1%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x) (* z t))) (t_2 (/ (/ x z) (- t))))
(if (<= (* z t) -2e+64)
t_2
(if (<= (* z t) -2e-34)
(/ x y)
(if (<= (* z t) -1e-61)
t_1
(if (<= (* z t) 5e-141)
(/ x y)
(if (<= (* z t) 5e-85)
t_2
(if (<= (* z t) 5e-55)
(/ x y)
(if (<= (* z t) 5e+76)
t_1
(if (<= (* z t) 2e+200) (/ x y) (- (/ (/ x t) z))))))))))))assert(z < t);
double code(double x, double y, double z, double t) {
double t_1 = -x / (z * t);
double t_2 = (x / z) / -t;
double tmp;
if ((z * t) <= -2e+64) {
tmp = t_2;
} else if ((z * t) <= -2e-34) {
tmp = x / y;
} else if ((z * t) <= -1e-61) {
tmp = t_1;
} else if ((z * t) <= 5e-141) {
tmp = x / y;
} else if ((z * t) <= 5e-85) {
tmp = t_2;
} else if ((z * t) <= 5e-55) {
tmp = x / y;
} else if ((z * t) <= 5e+76) {
tmp = t_1;
} else if ((z * t) <= 2e+200) {
tmp = x / y;
} else {
tmp = -((x / t) / z);
}
return tmp;
}
NOTE: 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = -x / (z * t)
t_2 = (x / z) / -t
if ((z * t) <= (-2d+64)) then
tmp = t_2
else if ((z * t) <= (-2d-34)) then
tmp = x / y
else if ((z * t) <= (-1d-61)) then
tmp = t_1
else if ((z * t) <= 5d-141) then
tmp = x / y
else if ((z * t) <= 5d-85) then
tmp = t_2
else if ((z * t) <= 5d-55) then
tmp = x / y
else if ((z * t) <= 5d+76) then
tmp = t_1
else if ((z * t) <= 2d+200) then
tmp = x / y
else
tmp = -((x / t) / z)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = -x / (z * t);
double t_2 = (x / z) / -t;
double tmp;
if ((z * t) <= -2e+64) {
tmp = t_2;
} else if ((z * t) <= -2e-34) {
tmp = x / y;
} else if ((z * t) <= -1e-61) {
tmp = t_1;
} else if ((z * t) <= 5e-141) {
tmp = x / y;
} else if ((z * t) <= 5e-85) {
tmp = t_2;
} else if ((z * t) <= 5e-55) {
tmp = x / y;
} else if ((z * t) <= 5e+76) {
tmp = t_1;
} else if ((z * t) <= 2e+200) {
tmp = x / y;
} else {
tmp = -((x / t) / z);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): t_1 = -x / (z * t) t_2 = (x / z) / -t tmp = 0 if (z * t) <= -2e+64: tmp = t_2 elif (z * t) <= -2e-34: tmp = x / y elif (z * t) <= -1e-61: tmp = t_1 elif (z * t) <= 5e-141: tmp = x / y elif (z * t) <= 5e-85: tmp = t_2 elif (z * t) <= 5e-55: tmp = x / y elif (z * t) <= 5e+76: tmp = t_1 elif (z * t) <= 2e+200: tmp = x / y else: tmp = -((x / t) / z) return tmp
z, t = sort([z, t]) function code(x, y, z, t) t_1 = Float64(Float64(-x) / Float64(z * t)) t_2 = Float64(Float64(x / z) / Float64(-t)) tmp = 0.0 if (Float64(z * t) <= -2e+64) tmp = t_2; elseif (Float64(z * t) <= -2e-34) tmp = Float64(x / y); elseif (Float64(z * t) <= -1e-61) tmp = t_1; elseif (Float64(z * t) <= 5e-141) tmp = Float64(x / y); elseif (Float64(z * t) <= 5e-85) tmp = t_2; elseif (Float64(z * t) <= 5e-55) tmp = Float64(x / y); elseif (Float64(z * t) <= 5e+76) tmp = t_1; elseif (Float64(z * t) <= 2e+200) tmp = Float64(x / y); else tmp = Float64(-Float64(Float64(x / t) / z)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = -x / (z * t);
t_2 = (x / z) / -t;
tmp = 0.0;
if ((z * t) <= -2e+64)
tmp = t_2;
elseif ((z * t) <= -2e-34)
tmp = x / y;
elseif ((z * t) <= -1e-61)
tmp = t_1;
elseif ((z * t) <= 5e-141)
tmp = x / y;
elseif ((z * t) <= 5e-85)
tmp = t_2;
elseif ((z * t) <= 5e-55)
tmp = x / y;
elseif ((z * t) <= 5e+76)
tmp = t_1;
elseif ((z * t) <= 2e+200)
tmp = x / y;
else
tmp = -((x / t) / z);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+64], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -2e-34], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-61], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-141], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-85], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], 5e-55], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+76], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e+200], N[(x / y), $MachinePrecision], (-N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision])]]]]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{-x}{z \cdot t}\\
t_2 := \frac{\frac{x}{z}}{-t}\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+64}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-34}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-85}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-55}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+200}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000004e64 or 4.9999999999999999e-141 < (*.f64 z t) < 5.0000000000000002e-85Initial program 91.5%
*-un-lft-identity91.5%
*-commutative91.5%
add-sqr-sqrt51.6%
sqrt-unprod61.3%
sqr-neg61.3%
sqrt-unprod14.8%
add-sqr-sqrt40.8%
distribute-rgt-neg-in40.8%
neg-mul-140.8%
add-sqr-sqrt26.0%
sqrt-unprod54.1%
sqr-neg54.1%
sqrt-unprod39.6%
add-sqr-sqrt91.5%
distribute-rgt-neg-in91.5%
prod-diff73.3%
Applied egg-rr73.3%
fma-udef73.3%
distribute-rgt-neg-in73.3%
metadata-eval73.3%
distribute-rgt-in73.3%
+-commutative73.3%
fma-def73.3%
*-lft-identity73.3%
fma-def73.3%
*-commutative73.3%
fma-def73.3%
fma-udef73.3%
distribute-lft-out73.3%
*-commutative73.3%
metadata-eval73.3%
Simplified73.3%
+-commutative73.3%
associate-*l*73.3%
fma-def91.4%
Applied egg-rr91.4%
Taylor expanded in t around inf 83.8%
distribute-rgt-in65.6%
*-commutative65.6%
associate-*l*65.6%
distribute-lft-in83.8%
associate-/r*91.1%
distribute-rgt1-in91.1%
metadata-eval91.1%
mul-1-neg91.1%
Simplified91.1%
if -2.00000000000000004e64 < (*.f64 z t) < -1.99999999999999986e-34 or -1e-61 < (*.f64 z t) < 4.9999999999999999e-141 or 5.0000000000000002e-85 < (*.f64 z t) < 5.0000000000000002e-55 or 4.99999999999999991e76 < (*.f64 z t) < 1.9999999999999999e200Initial program 99.9%
Taylor expanded in y around inf 83.8%
if -1.99999999999999986e-34 < (*.f64 z t) < -1e-61 or 5.0000000000000002e-55 < (*.f64 z t) < 4.99999999999999991e76Initial program 99.7%
Taylor expanded in y around 0 64.1%
associate-*r/64.1%
neg-mul-164.1%
Simplified64.1%
if 1.9999999999999999e200 < (*.f64 z t) Initial program 80.0%
Taylor expanded in y around 0 80.0%
mul-1-neg80.0%
associate-/r*99.9%
distribute-neg-frac99.9%
Simplified99.9%
Final simplification84.0%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (/ x z) (- t))))
(if (<= (* z t) -2e+64)
t_1
(if (<= (* z t) -2e-34)
(/ x y)
(if (<= (* z t) -1e-61)
(* x (/ (/ -1.0 t) z))
(if (<= (* z t) 5e-141)
(/ x y)
(if (<= (* z t) 5e-85)
t_1
(if (<= (* z t) 5e-55)
(/ x y)
(if (<= (* z t) 5e+76)
(/ (- x) (* z t))
(if (<= (* z t) 2e+200) (/ x y) (- (/ (/ x t) z))))))))))))assert(z < t);
double code(double x, double y, double z, double t) {
double t_1 = (x / z) / -t;
double tmp;
if ((z * t) <= -2e+64) {
tmp = t_1;
} else if ((z * t) <= -2e-34) {
tmp = x / y;
} else if ((z * t) <= -1e-61) {
tmp = x * ((-1.0 / t) / z);
} else if ((z * t) <= 5e-141) {
tmp = x / y;
} else if ((z * t) <= 5e-85) {
tmp = t_1;
} else if ((z * t) <= 5e-55) {
tmp = x / y;
} else if ((z * t) <= 5e+76) {
tmp = -x / (z * t);
} else if ((z * t) <= 2e+200) {
tmp = x / y;
} else {
tmp = -((x / t) / z);
}
return tmp;
}
NOTE: 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) :: t_1
real(8) :: tmp
t_1 = (x / z) / -t
if ((z * t) <= (-2d+64)) then
tmp = t_1
else if ((z * t) <= (-2d-34)) then
tmp = x / y
else if ((z * t) <= (-1d-61)) then
tmp = x * (((-1.0d0) / t) / z)
else if ((z * t) <= 5d-141) then
tmp = x / y
else if ((z * t) <= 5d-85) then
tmp = t_1
else if ((z * t) <= 5d-55) then
tmp = x / y
else if ((z * t) <= 5d+76) then
tmp = -x / (z * t)
else if ((z * t) <= 2d+200) then
tmp = x / y
else
tmp = -((x / t) / z)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) / -t;
double tmp;
if ((z * t) <= -2e+64) {
tmp = t_1;
} else if ((z * t) <= -2e-34) {
tmp = x / y;
} else if ((z * t) <= -1e-61) {
tmp = x * ((-1.0 / t) / z);
} else if ((z * t) <= 5e-141) {
tmp = x / y;
} else if ((z * t) <= 5e-85) {
tmp = t_1;
} else if ((z * t) <= 5e-55) {
tmp = x / y;
} else if ((z * t) <= 5e+76) {
tmp = -x / (z * t);
} else if ((z * t) <= 2e+200) {
tmp = x / y;
} else {
tmp = -((x / t) / z);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): t_1 = (x / z) / -t tmp = 0 if (z * t) <= -2e+64: tmp = t_1 elif (z * t) <= -2e-34: tmp = x / y elif (z * t) <= -1e-61: tmp = x * ((-1.0 / t) / z) elif (z * t) <= 5e-141: tmp = x / y elif (z * t) <= 5e-85: tmp = t_1 elif (z * t) <= 5e-55: tmp = x / y elif (z * t) <= 5e+76: tmp = -x / (z * t) elif (z * t) <= 2e+200: tmp = x / y else: tmp = -((x / t) / z) return tmp
z, t = sort([z, t]) function code(x, y, z, t) t_1 = Float64(Float64(x / z) / Float64(-t)) tmp = 0.0 if (Float64(z * t) <= -2e+64) tmp = t_1; elseif (Float64(z * t) <= -2e-34) tmp = Float64(x / y); elseif (Float64(z * t) <= -1e-61) tmp = Float64(x * Float64(Float64(-1.0 / t) / z)); elseif (Float64(z * t) <= 5e-141) tmp = Float64(x / y); elseif (Float64(z * t) <= 5e-85) tmp = t_1; elseif (Float64(z * t) <= 5e-55) tmp = Float64(x / y); elseif (Float64(z * t) <= 5e+76) tmp = Float64(Float64(-x) / Float64(z * t)); elseif (Float64(z * t) <= 2e+200) tmp = Float64(x / y); else tmp = Float64(-Float64(Float64(x / t) / z)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = (x / z) / -t;
tmp = 0.0;
if ((z * t) <= -2e+64)
tmp = t_1;
elseif ((z * t) <= -2e-34)
tmp = x / y;
elseif ((z * t) <= -1e-61)
tmp = x * ((-1.0 / t) / z);
elseif ((z * t) <= 5e-141)
tmp = x / y;
elseif ((z * t) <= 5e-85)
tmp = t_1;
elseif ((z * t) <= 5e-55)
tmp = x / y;
elseif ((z * t) <= 5e+76)
tmp = -x / (z * t);
elseif ((z * t) <= 2e+200)
tmp = x / y;
else
tmp = -((x / t) / z);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+64], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -2e-34], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-61], N[(x * N[(N[(-1.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-141], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-85], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-55], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+76], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+200], N[(x / y), $MachinePrecision], (-N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision])]]]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{z}}{-t}\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-34}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-61}:\\
\;\;\;\;x \cdot \frac{\frac{-1}{t}}{z}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-55}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+76}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+200}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000004e64 or 4.9999999999999999e-141 < (*.f64 z t) < 5.0000000000000002e-85Initial program 91.5%
*-un-lft-identity91.5%
*-commutative91.5%
add-sqr-sqrt51.6%
sqrt-unprod61.3%
sqr-neg61.3%
sqrt-unprod14.8%
add-sqr-sqrt40.8%
distribute-rgt-neg-in40.8%
neg-mul-140.8%
add-sqr-sqrt26.0%
sqrt-unprod54.1%
sqr-neg54.1%
sqrt-unprod39.6%
add-sqr-sqrt91.5%
distribute-rgt-neg-in91.5%
prod-diff73.3%
Applied egg-rr73.3%
fma-udef73.3%
distribute-rgt-neg-in73.3%
metadata-eval73.3%
distribute-rgt-in73.3%
+-commutative73.3%
fma-def73.3%
*-lft-identity73.3%
fma-def73.3%
*-commutative73.3%
fma-def73.3%
fma-udef73.3%
distribute-lft-out73.3%
*-commutative73.3%
metadata-eval73.3%
Simplified73.3%
+-commutative73.3%
associate-*l*73.3%
fma-def91.4%
Applied egg-rr91.4%
Taylor expanded in t around inf 83.8%
distribute-rgt-in65.6%
*-commutative65.6%
associate-*l*65.6%
distribute-lft-in83.8%
associate-/r*91.1%
distribute-rgt1-in91.1%
metadata-eval91.1%
mul-1-neg91.1%
Simplified91.1%
if -2.00000000000000004e64 < (*.f64 z t) < -1.99999999999999986e-34 or -1e-61 < (*.f64 z t) < 4.9999999999999999e-141 or 5.0000000000000002e-85 < (*.f64 z t) < 5.0000000000000002e-55 or 4.99999999999999991e76 < (*.f64 z t) < 1.9999999999999999e200Initial program 99.9%
Taylor expanded in y around inf 83.8%
if -1.99999999999999986e-34 < (*.f64 z t) < -1e-61Initial program 99.8%
*-un-lft-identity99.8%
*-commutative99.8%
add-sqr-sqrt42.6%
sqrt-unprod18.8%
sqr-neg18.8%
sqrt-unprod1.4%
add-sqr-sqrt16.1%
distribute-rgt-neg-in16.1%
neg-mul-116.1%
add-sqr-sqrt14.7%
sqrt-unprod32.5%
sqr-neg32.5%
sqrt-unprod56.7%
add-sqr-sqrt99.8%
distribute-rgt-neg-in99.8%
prod-diff99.8%
Applied egg-rr99.8%
fma-udef99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
distribute-rgt-in99.8%
+-commutative99.8%
fma-def99.8%
*-lft-identity99.8%
fma-def99.8%
*-commutative99.8%
fma-def99.8%
fma-udef99.8%
distribute-lft-out99.8%
*-commutative99.8%
metadata-eval99.8%
Simplified99.8%
+-commutative99.8%
associate-*l*99.8%
fma-def99.8%
Applied egg-rr99.8%
clear-num99.6%
associate-/r/99.3%
fma-udef99.3%
*-commutative99.3%
fma-def99.3%
Applied egg-rr99.3%
Taylor expanded in t around -inf 77.2%
associate-/r*76.6%
distribute-rgt-out76.6%
metadata-eval76.6%
*-rgt-identity76.6%
Simplified76.6%
if 5.0000000000000002e-55 < (*.f64 z t) < 4.99999999999999991e76Initial program 99.6%
Taylor expanded in y around 0 61.2%
associate-*r/61.2%
neg-mul-161.2%
Simplified61.2%
if 1.9999999999999999e200 < (*.f64 z t) Initial program 80.0%
Taylor expanded in y around 0 80.0%
mul-1-neg80.0%
associate-/r*99.9%
distribute-neg-frac99.9%
Simplified99.9%
Final simplification84.0%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 2e+200))) (- (/ (/ x t) z)) (/ x (- y (* z t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -((double) INFINITY)) || !((z * t) <= 2e+200)) {
tmp = -((x / t) / z);
} else {
tmp = x / (y - (z * t));
}
return tmp;
}
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -Double.POSITIVE_INFINITY) || !((z * t) <= 2e+200)) {
tmp = -((x / t) / z);
} else {
tmp = x / (y - (z * t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if ((z * t) <= -math.inf) or not ((z * t) <= 2e+200): tmp = -((x / t) / z) else: tmp = x / (y - (z * t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((Float64(z * t) <= Float64(-Inf)) || !(Float64(z * t) <= 2e+200)) tmp = Float64(-Float64(Float64(x / t) / z)); else tmp = Float64(x / Float64(y - Float64(z * t))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (((z * t) <= -Inf) || ~(((z * t) <= 2e+200)))
tmp = -((x / t) / z);
else
tmp = x / (y - (z * t));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+200]], $MachinePrecision]], (-N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+200}\right):\\
\;\;\;\;-\frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 1.9999999999999999e200 < (*.f64 z t) Initial program 76.4%
Taylor expanded in y around 0 76.4%
mul-1-neg76.4%
associate-/r*99.8%
distribute-neg-frac99.8%
Simplified99.8%
if -inf.0 < (*.f64 z t) < 1.9999999999999999e200Initial program 99.8%
Final simplification99.8%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x) (* z t))))
(if (<= y -5.2e+85)
(/ x y)
(if (<= y -1.65e+21)
t_1
(if (<= y -8.5e-37)
(/ x y)
(if (<= y 1060000000.0) t_1 (/ 1.0 (/ y x))))))))assert(z < t);
double code(double x, double y, double z, double t) {
double t_1 = -x / (z * t);
double tmp;
if (y <= -5.2e+85) {
tmp = x / y;
} else if (y <= -1.65e+21) {
tmp = t_1;
} else if (y <= -8.5e-37) {
tmp = x / y;
} else if (y <= 1060000000.0) {
tmp = t_1;
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
NOTE: 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) :: t_1
real(8) :: tmp
t_1 = -x / (z * t)
if (y <= (-5.2d+85)) then
tmp = x / y
else if (y <= (-1.65d+21)) then
tmp = t_1
else if (y <= (-8.5d-37)) then
tmp = x / y
else if (y <= 1060000000.0d0) then
tmp = t_1
else
tmp = 1.0d0 / (y / x)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = -x / (z * t);
double tmp;
if (y <= -5.2e+85) {
tmp = x / y;
} else if (y <= -1.65e+21) {
tmp = t_1;
} else if (y <= -8.5e-37) {
tmp = x / y;
} else if (y <= 1060000000.0) {
tmp = t_1;
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): t_1 = -x / (z * t) tmp = 0 if y <= -5.2e+85: tmp = x / y elif y <= -1.65e+21: tmp = t_1 elif y <= -8.5e-37: tmp = x / y elif y <= 1060000000.0: tmp = t_1 else: tmp = 1.0 / (y / x) return tmp
z, t = sort([z, t]) function code(x, y, z, t) t_1 = Float64(Float64(-x) / Float64(z * t)) tmp = 0.0 if (y <= -5.2e+85) tmp = Float64(x / y); elseif (y <= -1.65e+21) tmp = t_1; elseif (y <= -8.5e-37) tmp = Float64(x / y); elseif (y <= 1060000000.0) tmp = t_1; else tmp = Float64(1.0 / Float64(y / x)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = -x / (z * t);
tmp = 0.0;
if (y <= -5.2e+85)
tmp = x / y;
elseif (y <= -1.65e+21)
tmp = t_1;
elseif (y <= -8.5e-37)
tmp = x / y;
elseif (y <= 1060000000.0)
tmp = t_1;
else
tmp = 1.0 / (y / x);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e+85], N[(x / y), $MachinePrecision], If[LessEqual[y, -1.65e+21], t$95$1, If[LessEqual[y, -8.5e-37], N[(x / y), $MachinePrecision], If[LessEqual[y, 1060000000.0], t$95$1, N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{-x}{z \cdot t}\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+85}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-37}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 1060000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\end{array}
\end{array}
if y < -5.20000000000000021e85 or -1.65e21 < y < -8.5000000000000007e-37Initial program 96.9%
Taylor expanded in y around inf 80.1%
if -5.20000000000000021e85 < y < -1.65e21 or -8.5000000000000007e-37 < y < 1.06e9Initial program 95.3%
Taylor expanded in y around 0 71.4%
associate-*r/71.4%
neg-mul-171.4%
Simplified71.4%
if 1.06e9 < y Initial program 97.0%
*-un-lft-identity97.0%
*-commutative97.0%
add-sqr-sqrt39.1%
sqrt-unprod88.1%
sqr-neg88.1%
sqrt-unprod56.4%
add-sqr-sqrt90.2%
distribute-rgt-neg-in90.2%
neg-mul-190.2%
add-sqr-sqrt33.8%
sqrt-unprod85.8%
sqr-neg85.8%
sqrt-unprod57.9%
add-sqr-sqrt97.0%
distribute-rgt-neg-in97.0%
prod-diff90.6%
Applied egg-rr90.6%
fma-udef90.6%
distribute-rgt-neg-in90.6%
metadata-eval90.6%
distribute-rgt-in90.6%
+-commutative90.6%
fma-def90.6%
*-lft-identity90.6%
fma-def90.6%
*-commutative90.6%
fma-def90.6%
fma-udef90.6%
distribute-lft-out90.6%
*-commutative90.6%
metadata-eval90.6%
Simplified90.6%
clear-num90.4%
inv-pow90.4%
+-commutative90.4%
associate-*l*90.4%
fma-def96.8%
Applied egg-rr96.8%
unpow-196.8%
fma-udef90.4%
fma-udef90.4%
associate-+r+90.3%
associate-*r*90.3%
*-commutative90.3%
associate-*r*90.3%
distribute-rgt-in96.8%
+-commutative96.8%
fma-def96.8%
distribute-rgt1-in96.8%
metadata-eval96.8%
mul-1-neg96.8%
Simplified96.8%
Taylor expanded in z around 0 87.0%
Final simplification77.0%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= (* z t) -5e+182) (not (<= (* z t) 4e+138))) (/ x (* z t)) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -5e+182) || !((z * t) <= 4e+138)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
NOTE: 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 * t) <= (-5d+182)) .or. (.not. ((z * t) <= 4d+138))) then
tmp = x / (z * t)
else
tmp = x / y
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -5e+182) || !((z * t) <= 4e+138)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if ((z * t) <= -5e+182) or not ((z * t) <= 4e+138): tmp = x / (z * t) else: tmp = x / y return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((Float64(z * t) <= -5e+182) || !(Float64(z * t) <= 4e+138)) tmp = Float64(x / Float64(z * t)); else tmp = Float64(x / y); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (((z * t) <= -5e+182) || ~(((z * t) <= 4e+138)))
tmp = x / (z * t);
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -5e+182], N[Not[LessEqual[N[(z * t), $MachinePrecision], 4e+138]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+182} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{+138}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999973e182 or 4.0000000000000001e138 < (*.f64 z t) Initial program 82.4%
flip3--0.0%
clear-num0.0%
Applied egg-rr0.0%
Taylor expanded in y around 0 80.6%
associate-/r*80.5%
Simplified80.5%
clear-num80.6%
div-inv80.6%
frac-2neg80.6%
metadata-eval80.6%
remove-double-div80.6%
add-sqr-sqrt44.7%
sqrt-unprod66.7%
sqr-neg66.7%
sqrt-unprod30.6%
add-sqr-sqrt57.7%
Applied egg-rr57.7%
if -4.99999999999999973e182 < (*.f64 z t) < 4.0000000000000001e138Initial program 99.8%
Taylor expanded in y around inf 67.5%
Final simplification65.4%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ 1.0 (/ y x)))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 / (y / x);
}
NOTE: 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 / x)
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 / (y / x);
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 / (y / x)
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 / Float64(y / x)) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 / (y / x);
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\frac{1}{\frac{y}{x}}
\end{array}
Initial program 96.1%
*-un-lft-identity96.1%
*-commutative96.1%
add-sqr-sqrt46.2%
sqrt-unprod72.4%
sqr-neg72.4%
sqrt-unprod33.5%
add-sqr-sqrt64.2%
distribute-rgt-neg-in64.2%
neg-mul-164.2%
add-sqr-sqrt30.7%
sqrt-unprod71.3%
sqr-neg71.3%
sqrt-unprod49.7%
add-sqr-sqrt96.1%
distribute-rgt-neg-in96.1%
prod-diff87.7%
Applied egg-rr87.7%
fma-udef87.7%
distribute-rgt-neg-in87.7%
metadata-eval87.7%
distribute-rgt-in87.7%
+-commutative87.7%
fma-def87.7%
*-lft-identity87.7%
fma-def87.7%
*-commutative87.7%
fma-def87.7%
fma-udef87.7%
distribute-lft-out87.7%
*-commutative87.7%
metadata-eval87.7%
Simplified87.7%
clear-num87.3%
inv-pow87.3%
+-commutative87.3%
associate-*l*87.3%
fma-def95.6%
Applied egg-rr95.6%
unpow-195.6%
fma-udef87.3%
fma-udef87.3%
associate-+r+87.3%
associate-*r*87.3%
*-commutative87.3%
associate-*r*87.3%
distribute-rgt-in95.7%
+-commutative95.7%
fma-def95.7%
distribute-rgt1-in95.7%
metadata-eval95.7%
mul-1-neg95.7%
Simplified95.7%
Taylor expanded in z around 0 55.8%
Final simplification55.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ x y))
assert(z < t);
double code(double x, double y, double z, double t) {
return x / y;
}
NOTE: 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 z < t;
public static double code(double x, double y, double z, double t) {
return x / y;
}
[z, t] = sort([z, t]) def code(x, y, z, t): return x / y
z, t = sort([z, t]) function code(x, y, z, t) return Float64(x / y) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = x / y;
end
NOTE: 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
\frac{x}{y}
\end{array}
Initial program 96.1%
Taylor expanded in y around inf 55.7%
Final simplification55.7%
(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 2023299
(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))))