
(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 7 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) -1e+272) (/ (/ x z) (- t)) (if (<= (* z t) 2e+135) (/ 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) <= -1e+272) {
tmp = (x / z) / -t;
} else if ((z * t) <= 2e+135) {
tmp = x / (y - (z * t));
} 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 * t) <= (-1d+272)) then
tmp = (x / z) / -t
else if ((z * t) <= 2d+135) then
tmp = x / (y - (z * t))
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 * t) <= -1e+272) {
tmp = (x / z) / -t;
} else if ((z * t) <= 2e+135) {
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) <= -1e+272: tmp = (x / z) / -t elif (z * t) <= 2e+135: 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) <= -1e+272) tmp = Float64(Float64(x / z) / Float64(-t)); elseif (Float64(z * t) <= 2e+135) 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) <= -1e+272)
tmp = (x / z) / -t;
elseif ((z * t) <= 2e+135)
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], -1e+272], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+135], 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 -1 \cdot 10^{+272}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+135}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.0000000000000001e272Initial program 70.6%
clear-num70.7%
inv-pow70.7%
Applied egg-rr70.7%
Taylor expanded in y around 0 70.7%
mul-1-neg70.7%
associate-*l/97.5%
*-commutative97.5%
distribute-rgt-neg-in97.5%
mul-1-neg97.5%
associate-*r/97.5%
neg-mul-197.5%
Simplified97.5%
unpow-prod-down99.9%
inv-pow99.9%
unpow-199.9%
clear-num99.9%
add-sqr-sqrt42.9%
sqrt-unprod66.0%
sqr-neg66.0%
sqrt-unprod22.8%
add-sqr-sqrt61.1%
times-frac61.6%
*-un-lft-identity61.6%
frac-2neg61.6%
distribute-rgt-neg-in61.6%
add-sqr-sqrt38.3%
sqrt-unprod70.6%
sqr-neg70.6%
sqrt-unprod32.3%
add-sqr-sqrt70.6%
Applied egg-rr70.6%
Taylor expanded in x around 0 70.6%
mul-1-neg70.6%
associate-/r*99.9%
associate-/l/70.6%
associate-/r*99.9%
distribute-frac-neg299.9%
Simplified99.9%
if -1.0000000000000001e272 < (*.f64 z t) < 1.99999999999999992e135Initial program 99.9%
if 1.99999999999999992e135 < (*.f64 z t) Initial program 82.6%
clear-num82.4%
inv-pow82.4%
Applied egg-rr82.4%
Taylor expanded in y around 0 82.4%
mul-1-neg82.4%
associate-*l/99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
mul-1-neg99.5%
associate-*r/99.5%
neg-mul-199.5%
Simplified99.5%
*-commutative99.5%
unpow-prod-down99.7%
unpow-199.7%
clear-num99.7%
add-sqr-sqrt44.5%
sqrt-unprod64.9%
sqr-neg64.9%
sqrt-unprod29.9%
add-sqr-sqrt52.0%
inv-pow52.0%
div-inv52.0%
frac-2neg52.0%
distribute-frac-neg252.0%
add-sqr-sqrt22.1%
sqrt-unprod70.1%
sqr-neg70.1%
sqrt-unprod55.0%
add-sqr-sqrt99.8%
Applied egg-rr99.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 (<= (* z t) -5e+124) (not (<= (* z t) 4e+25))) (/ (/ 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 (((z * t) <= -5e+124) || !((z * t) <= 4e+25)) {
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 (((z * t) <= (-5d+124)) .or. (.not. ((z * t) <= 4d+25))) 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 (((z * t) <= -5e+124) || !((z * t) <= 4e+25)) {
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 ((z * t) <= -5e+124) or not ((z * t) <= 4e+25): 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 ((Float64(z * t) <= -5e+124) || !(Float64(z * t) <= 4e+25)) 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 (((z * t) <= -5e+124) || ~(((z * t) <= 4e+25)))
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[N[(z * t), $MachinePrecision], -5e+124], N[Not[LessEqual[N[(z * t), $MachinePrecision], 4e+25]], $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}\;z \cdot t \leq -5 \cdot 10^{+124} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999996e124 or 4.00000000000000036e25 < (*.f64 z t) Initial program 87.8%
clear-num86.9%
inv-pow86.9%
Applied egg-rr86.9%
Taylor expanded in y around 0 79.7%
mul-1-neg79.7%
associate-*l/88.2%
*-commutative88.2%
distribute-rgt-neg-in88.2%
mul-1-neg88.2%
associate-*r/88.2%
neg-mul-188.2%
Simplified88.2%
*-commutative88.2%
unpow-prod-down88.5%
unpow-188.5%
clear-num89.9%
add-sqr-sqrt45.0%
sqrt-unprod60.8%
sqr-neg60.8%
sqrt-unprod20.1%
add-sqr-sqrt45.7%
inv-pow45.7%
div-inv45.7%
frac-2neg45.7%
distribute-frac-neg245.7%
add-sqr-sqrt25.5%
sqrt-unprod61.1%
sqr-neg61.1%
sqrt-unprod44.7%
add-sqr-sqrt90.0%
Applied egg-rr90.0%
if -4.9999999999999996e124 < (*.f64 z t) < 4.00000000000000036e25Initial program 99.9%
Taylor expanded in y around inf 78.4%
Final simplification83.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 (<= (* z t) -5e+34) (not (<= (* z t) 4e+25))) (/ 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 (((z * t) <= -5e+34) || !((z * t) <= 4e+25)) {
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 (((z * t) <= (-5d+34)) .or. (.not. ((z * t) <= 4d+25))) 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 (((z * t) <= -5e+34) || !((z * t) <= 4e+25)) {
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 ((z * t) <= -5e+34) or not ((z * t) <= 4e+25): 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 ((Float64(z * t) <= -5e+34) || !(Float64(z * t) <= 4e+25)) 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 (((z * t) <= -5e+34) || ~(((z * t) <= 4e+25)))
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[N[(z * t), $MachinePrecision], -5e+34], N[Not[LessEqual[N[(z * t), $MachinePrecision], 4e+25]], $MachinePrecision]], 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}\;z \cdot t \leq -5 \cdot 10^{+34} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{x}{t \cdot \left(-z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999998e34 or 4.00000000000000036e25 < (*.f64 z t) Initial program 89.1%
Taylor expanded in y around 0 77.5%
associate-*r/77.5%
neg-mul-177.5%
Simplified77.5%
if -4.9999999999999998e34 < (*.f64 z t) < 4.00000000000000036e25Initial program 99.9%
Taylor expanded in y around inf 81.3%
Final simplification79.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 t) -5e+112) (/ (/ x z) (- t)) (if (<= (* z t) 4e+25) (/ 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 * t) <= -5e+112) {
tmp = (x / z) / -t;
} else if ((z * t) <= 4e+25) {
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 * t) <= (-5d+112)) then
tmp = (x / z) / -t
else if ((z * t) <= 4d+25) 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 * t) <= -5e+112) {
tmp = (x / z) / -t;
} else if ((z * t) <= 4e+25) {
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 * t) <= -5e+112: tmp = (x / z) / -t elif (z * t) <= 4e+25: 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 (Float64(z * t) <= -5e+112) tmp = Float64(Float64(x / z) / Float64(-t)); elseif (Float64(z * t) <= 4e+25) 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 * t) <= -5e+112)
tmp = (x / z) / -t;
elseif ((z * t) <= 4e+25)
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[N[(z * t), $MachinePrecision], -5e+112], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+25], 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 \cdot t \leq -5 \cdot 10^{+112}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+25}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\end{array}
\end{array}
if (*.f64 z t) < -5e112Initial program 86.0%
clear-num84.2%
inv-pow84.2%
Applied egg-rr84.2%
Taylor expanded in y around 0 82.0%
mul-1-neg82.0%
associate-*l/92.7%
*-commutative92.7%
distribute-rgt-neg-in92.7%
mul-1-neg92.7%
associate-*r/92.7%
neg-mul-192.7%
Simplified92.7%
unpow-prod-down94.5%
inv-pow94.5%
unpow-194.5%
clear-num95.9%
add-sqr-sqrt56.7%
sqrt-unprod75.9%
sqr-neg75.9%
sqrt-unprod19.4%
add-sqr-sqrt55.8%
times-frac56.0%
*-un-lft-identity56.0%
frac-2neg56.0%
distribute-rgt-neg-in56.0%
add-sqr-sqrt36.4%
sqrt-unprod60.3%
sqr-neg60.3%
sqrt-unprod29.1%
add-sqr-sqrt83.7%
Applied egg-rr83.7%
Taylor expanded in x around 0 83.7%
mul-1-neg83.7%
associate-/r*95.9%
associate-/l/83.7%
associate-/r*95.5%
distribute-frac-neg295.5%
Simplified95.5%
if -5e112 < (*.f64 z t) < 4.00000000000000036e25Initial program 99.9%
Taylor expanded in y around inf 79.3%
if 4.00000000000000036e25 < (*.f64 z t) Initial program 89.6%
clear-num89.4%
inv-pow89.4%
Applied egg-rr89.4%
Taylor expanded in y around 0 77.5%
mul-1-neg77.5%
associate-*l/84.2%
*-commutative84.2%
distribute-rgt-neg-in84.2%
mul-1-neg84.2%
associate-*r/84.2%
neg-mul-184.2%
Simplified84.2%
*-commutative84.2%
unpow-prod-down83.4%
unpow-183.4%
clear-num84.7%
add-sqr-sqrt37.9%
sqrt-unprod50.5%
sqr-neg50.5%
sqrt-unprod19.8%
add-sqr-sqrt38.3%
inv-pow38.3%
div-inv38.3%
frac-2neg38.3%
distribute-frac-neg238.3%
add-sqr-sqrt18.5%
sqrt-unprod58.2%
sqr-neg58.2%
sqrt-unprod46.6%
add-sqr-sqrt84.8%
Applied egg-rr84.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 (<= (* z t) -5e+112) (not (<= (* z t) 2e+100))) (/ 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 (((z * t) <= -5e+112) || !((z * t) <= 2e+100)) {
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 (((z * t) <= (-5d+112)) .or. (.not. ((z * t) <= 2d+100))) 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 (((z * t) <= -5e+112) || !((z * t) <= 2e+100)) {
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 ((z * t) <= -5e+112) or not ((z * t) <= 2e+100): 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 ((Float64(z * t) <= -5e+112) || !(Float64(z * t) <= 2e+100)) 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 (((z * t) <= -5e+112) || ~(((z * t) <= 2e+100)))
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[N[(z * t), $MachinePrecision], -5e+112], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+100]], $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}\;z \cdot t \leq -5 \cdot 10^{+112} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+100}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -5e112 or 2.00000000000000003e100 < (*.f64 z t) Initial program 85.6%
clear-num84.7%
inv-pow84.7%
Applied egg-rr84.7%
Taylor expanded in y around 0 83.6%
mul-1-neg83.6%
associate-*l/96.2%
*-commutative96.2%
distribute-rgt-neg-in96.2%
mul-1-neg96.2%
associate-*r/96.2%
neg-mul-196.2%
Simplified96.2%
unpow-prod-down97.2%
inv-pow97.2%
unpow-197.2%
clear-num97.8%
add-sqr-sqrt52.6%
sqrt-unprod71.0%
sqr-neg71.0%
sqrt-unprod23.6%
add-sqr-sqrt54.5%
times-frac54.3%
*-un-lft-identity54.3%
Applied egg-rr54.3%
if -5e112 < (*.f64 z t) < 2.00000000000000003e100Initial program 99.9%
Taylor expanded in y around inf 75.3%
Final simplification68.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 (<= (* z t) -5e+112) (/ x (* z t)) (if (<= (* z t) 2e+100) (/ 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 * t) <= -5e+112) {
tmp = x / (z * t);
} else if ((z * t) <= 2e+100) {
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 * t) <= (-5d+112)) then
tmp = x / (z * t)
else if ((z * t) <= 2d+100) 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 * t) <= -5e+112) {
tmp = x / (z * t);
} else if ((z * t) <= 2e+100) {
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 * t) <= -5e+112: tmp = x / (z * t) elif (z * t) <= 2e+100: 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 (Float64(z * t) <= -5e+112) tmp = Float64(x / Float64(z * t)); elseif (Float64(z * t) <= 2e+100) tmp = Float64(x / y); else tmp = Float64(Float64(x / z) / t); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((z * t) <= -5e+112)
tmp = x / (z * t);
elseif ((z * t) <= 2e+100)
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[N[(z * t), $MachinePrecision], -5e+112], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+100], N[(x / y), $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 -5 \cdot 10^{+112}:\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+100}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < -5e112Initial program 86.0%
clear-num84.2%
inv-pow84.2%
Applied egg-rr84.2%
Taylor expanded in y around 0 82.0%
mul-1-neg82.0%
associate-*l/92.7%
*-commutative92.7%
distribute-rgt-neg-in92.7%
mul-1-neg92.7%
associate-*r/92.7%
neg-mul-192.7%
Simplified92.7%
unpow-prod-down94.5%
inv-pow94.5%
unpow-194.5%
clear-num95.9%
add-sqr-sqrt56.7%
sqrt-unprod75.9%
sqr-neg75.9%
sqrt-unprod19.4%
add-sqr-sqrt55.8%
times-frac56.0%
*-un-lft-identity56.0%
Applied egg-rr56.0%
if -5e112 < (*.f64 z t) < 2.00000000000000003e100Initial program 99.9%
Taylor expanded in y around inf 75.3%
if 2.00000000000000003e100 < (*.f64 z t) Initial program 85.2%
clear-num85.1%
associate-/r/85.1%
Applied egg-rr85.1%
Taylor expanded in t around inf 86.5%
associate-*r/86.5%
mul-1-neg86.5%
Simplified86.5%
Taylor expanded in y around 0 84.4%
associate-/r*87.9%
Simplified87.9%
associate-/l/84.4%
associate-*l/84.5%
neg-mul-184.5%
add-sqr-sqrt41.5%
sqrt-unprod63.4%
sqr-neg63.4%
sqrt-unprod30.1%
add-sqr-sqrt52.7%
associate-/r*52.5%
Applied egg-rr52.5%
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.9%
Taylor expanded in y around inf 56.6%
(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 2024091
(FPCore (x y z t)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:alt
(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))))