
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (* z t) -2e+192) (/ (/ (- x) t) z) (if (<= (* z t) 2e+291) (/ 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) <= -2e+192) {
tmp = (-x / t) / z;
} else if ((z * t) <= 2e+291) {
tmp = x / (y - (z * t));
} 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) <= (-2d+192)) then
tmp = (-x / t) / z
else if ((z * t) <= 2d+291) then
tmp = x / (y - (z * t))
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) <= -2e+192) {
tmp = (-x / t) / z;
} else if ((z * t) <= 2e+291) {
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) <= -2e+192: tmp = (-x / t) / z elif (z * t) <= 2e+291: 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) <= -2e+192) tmp = Float64(Float64(Float64(-x) / t) / z); elseif (Float64(z * t) <= 2e+291) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(Float64(x / z) / Float64(-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) <= -2e+192)
tmp = (-x / t) / z;
elseif ((z * t) <= 2e+291)
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], -2e+192], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+291], 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 -2 \cdot 10^{+192}:\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+291}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000008e192Initial program 77.2%
clear-num77.1%
associate-/r/77.2%
Applied egg-rr77.2%
Taylor expanded in y around 0 77.2%
mul-1-neg77.2%
associate-/r*99.6%
distribute-frac-neg299.6%
Simplified99.6%
if -2.00000000000000008e192 < (*.f64 z t) < 1.9999999999999999e291Initial program 99.9%
if 1.9999999999999999e291 < (*.f64 z t) Initial program 68.6%
clear-num68.6%
inv-pow68.6%
Applied egg-rr68.6%
Taylor expanded in y around inf 68.4%
+-commutative68.4%
mul-1-neg68.4%
unsub-neg68.4%
associate-/l*79.9%
Simplified79.9%
Taylor expanded in y around 0 68.6%
neg-mul-168.6%
associate-/l/99.9%
distribute-frac-neg299.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 (or (<= z -2.9e-63) (not (<= z 3e-137))) (/ (/ (- 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 <= -2.9e-63) || !(z <= 3e-137)) {
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 <= (-2.9d-63)) .or. (.not. (z <= 3d-137))) 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 <= -2.9e-63) || !(z <= 3e-137)) {
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 <= -2.9e-63) or not (z <= 3e-137): 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 ((z <= -2.9e-63) || !(z <= 3e-137)) 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 ((z <= -2.9e-63) || ~((z <= 3e-137)))
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[z, -2.9e-63], N[Not[LessEqual[z, 3e-137]], $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 \leq -2.9 \cdot 10^{-63} \lor \neg \left(z \leq 3 \cdot 10^{-137}\right):\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -2.89999999999999975e-63 or 2.9999999999999998e-137 < z Initial program 92.3%
clear-num91.6%
associate-/r/92.1%
Applied egg-rr92.1%
Taylor expanded in y around 0 58.7%
mul-1-neg58.7%
associate-/r*63.5%
distribute-frac-neg263.5%
Simplified63.5%
if -2.89999999999999975e-63 < z < 2.9999999999999998e-137Initial program 100.0%
Taylor expanded in y around inf 81.9%
Final simplification69.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= z -1.05e-62) (not (<= z 1.18e-122))) (/ (- 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 <= -1.05e-62) || !(z <= 1.18e-122)) {
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 <= (-1.05d-62)) .or. (.not. (z <= 1.18d-122))) 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 <= -1.05e-62) || !(z <= 1.18e-122)) {
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 <= -1.05e-62) or not (z <= 1.18e-122): 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 ((z <= -1.05e-62) || !(z <= 1.18e-122)) 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 ((z <= -1.05e-62) || ~((z <= 1.18e-122)))
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[z, -1.05e-62], N[Not[LessEqual[z, 1.18e-122]], $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 \leq -1.05 \cdot 10^{-62} \lor \neg \left(z \leq 1.18 \cdot 10^{-122}\right):\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -1.05e-62 or 1.17999999999999998e-122 < z Initial program 92.2%
Taylor expanded in y around 0 59.0%
associate-*r/59.0%
neg-mul-159.0%
Simplified59.0%
if -1.05e-62 < z < 1.17999999999999998e-122Initial program 100.0%
Taylor expanded in y around inf 82.1%
Final simplification66.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -6.8e-63) (/ (/ x z) (- t)) (if (<= z 3.4e-136) (/ 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 <= -6.8e-63) {
tmp = (x / z) / -t;
} else if (z <= 3.4e-136) {
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 <= (-6.8d-63)) then
tmp = (x / z) / -t
else if (z <= 3.4d-136) 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 <= -6.8e-63) {
tmp = (x / z) / -t;
} else if (z <= 3.4e-136) {
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 <= -6.8e-63: tmp = (x / z) / -t elif z <= 3.4e-136: tmp = x / y else: tmp = (-x / t) / z return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -6.8e-63) tmp = Float64(Float64(x / z) / Float64(-t)); elseif (z <= 3.4e-136) 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 (z <= -6.8e-63)
tmp = (x / z) / -t;
elseif (z <= 3.4e-136)
tmp = x / y;
else
tmp = (-x / t) / z;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -6.8e-63], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[z, 3.4e-136], N[(x / y), $MachinePrecision], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-63}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-136}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\end{array}
\end{array}
if z < -6.79999999999999997e-63Initial program 90.6%
clear-num89.2%
inv-pow89.2%
Applied egg-rr89.2%
Taylor expanded in y around inf 73.8%
+-commutative73.8%
mul-1-neg73.8%
unsub-neg73.8%
associate-/l*72.4%
Simplified72.4%
Taylor expanded in y around 0 68.0%
neg-mul-168.0%
associate-/l/76.1%
distribute-frac-neg276.1%
Simplified76.1%
if -6.79999999999999997e-63 < z < 3.4e-136Initial program 100.0%
Taylor expanded in y around inf 81.9%
if 3.4e-136 < z Initial program 93.5%
clear-num93.2%
associate-/r/93.2%
Applied egg-rr93.2%
Taylor expanded in y around 0 52.2%
mul-1-neg52.2%
associate-/r*58.4%
distribute-frac-neg258.4%
Simplified58.4%
Final simplification70.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 -1.1e+151) (not (<= z 2.7e+72))) (/ 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 <= -1.1e+151) || !(z <= 2.7e+72)) {
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 <= (-1.1d+151)) .or. (.not. (z <= 2.7d+72))) 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 <= -1.1e+151) || !(z <= 2.7e+72)) {
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 <= -1.1e+151) or not (z <= 2.7e+72): 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 ((z <= -1.1e+151) || !(z <= 2.7e+72)) 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 <= -1.1e+151) || ~((z <= 2.7e+72)))
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[z, -1.1e+151], N[Not[LessEqual[z, 2.7e+72]], $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 \leq -1.1 \cdot 10^{+151} \lor \neg \left(z \leq 2.7 \cdot 10^{+72}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -1.10000000000000003e151 or 2.7000000000000001e72 < z Initial program 90.9%
clear-num90.4%
associate-/r/90.8%
Applied egg-rr90.8%
Taylor expanded in y around 0 63.2%
metadata-eval63.2%
*-commutative63.2%
distribute-neg-frac63.2%
associate-/r*63.9%
distribute-neg-frac63.9%
distribute-neg-frac63.9%
metadata-eval63.9%
Simplified63.9%
associate-/l/63.2%
associate-*l/63.3%
neg-mul-163.3%
add-sqr-sqrt31.8%
sqrt-unprod38.6%
sqr-neg38.6%
sqrt-unprod14.3%
add-sqr-sqrt31.3%
Applied egg-rr31.3%
if -1.10000000000000003e151 < z < 2.7000000000000001e72Initial program 96.9%
Taylor expanded in y around inf 64.0%
Final simplification51.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 -1.7e+151) (/ (/ x z) t) (if (<= z 2.1e+75) (/ 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 <= -1.7e+151) {
tmp = (x / z) / t;
} else if (z <= 2.1e+75) {
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 <= (-1.7d+151)) then
tmp = (x / z) / t
else if (z <= 2.1d+75) 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 <= -1.7e+151) {
tmp = (x / z) / t;
} else if (z <= 2.1e+75) {
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 <= -1.7e+151: tmp = (x / z) / t elif z <= 2.1e+75: tmp = x / y else: tmp = x / (z * t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e+151) tmp = Float64(Float64(x / z) / t); elseif (z <= 2.1e+75) tmp = Float64(x / y); else tmp = Float64(x / Float64(z * t)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -1.7e+151)
tmp = (x / z) / t;
elseif (z <= 2.1e+75)
tmp = x / y;
else
tmp = x / (z * t);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -1.7e+151], N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 2.1e+75], N[(x / y), $MachinePrecision], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+151}:\\
\;\;\;\;\frac{\frac{x}{z}}{t}\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+75}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot t}\\
\end{array}
\end{array}
if z < -1.7e151Initial program 85.0%
Taylor expanded in y around 0 75.8%
associate-*r/75.8%
neg-mul-175.8%
Simplified75.8%
div-inv75.8%
add-sqr-sqrt39.1%
sqrt-unprod47.8%
sqr-neg47.8%
sqrt-unprod18.1%
add-sqr-sqrt46.2%
*-commutative46.2%
associate-/r*46.2%
Applied egg-rr46.2%
associate-*r/47.9%
associate-*r/47.9%
*-rgt-identity47.9%
Simplified47.9%
if -1.7e151 < z < 2.09999999999999999e75Initial program 97.0%
Taylor expanded in y around inf 64.5%
if 2.09999999999999999e75 < z Initial program 93.4%
clear-num93.2%
associate-/r/93.3%
Applied egg-rr93.3%
Taylor expanded in y around 0 59.6%
metadata-eval59.6%
*-commutative59.6%
distribute-neg-frac59.6%
associate-/r*60.6%
distribute-neg-frac60.6%
distribute-neg-frac60.6%
metadata-eval60.6%
Simplified60.6%
associate-/l/59.6%
associate-*l/59.7%
neg-mul-159.7%
add-sqr-sqrt30.4%
sqrt-unprod36.7%
sqr-neg36.7%
sqrt-unprod13.3%
add-sqr-sqrt25.7%
Applied egg-rr25.7%
Final simplification53.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ 1.0 (/ y x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 / (y / x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 / (y / x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 / (y / x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 / (y / x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 / Float64(y / x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 / (y / x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\frac{y}{x}}
\end{array}
Initial program 94.7%
clear-num94.2%
associate-/r/94.5%
Applied egg-rr94.5%
Taylor expanded in y around inf 52.6%
associate-*l/52.7%
*-un-lft-identity52.7%
clear-num52.8%
Applied egg-rr52.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ x y))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return x / y;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / y
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return x / y;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return x / y
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(x / y) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = x / y;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{x}{y}
\end{array}
Initial program 94.7%
Taylor expanded in y around inf 52.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 2024085
(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))))