
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* z t) -5e+307) (/ z (/ (- a) t)) (if (<= (* z t) 1e+257) (/ (- (* x y) (* z t)) a) (* t (/ (- z) a)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -5e+307) {
tmp = z / (-a / t);
} else if ((z * t) <= 1e+257) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t * (-z / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z * t) <= (-5d+307)) then
tmp = z / (-a / t)
else if ((z * t) <= 1d+257) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t * (-z / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -5e+307) {
tmp = z / (-a / t);
} else if ((z * t) <= 1e+257) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t * (-z / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -5e+307: tmp = z / (-a / t) elif (z * t) <= 1e+257: tmp = ((x * y) - (z * t)) / a else: tmp = t * (-z / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= -5e+307) tmp = Float64(z / Float64(Float64(-a) / t)); elseif (Float64(z * t) <= 1e+257) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(t * Float64(Float64(-z) / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= -5e+307)
tmp = z / (-a / t);
elseif ((z * t) <= 1e+257)
tmp = ((x * y) - (z * t)) / a;
else
tmp = t * (-z / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+307], N[(z / N[((-a) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+257], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+307}:\\
\;\;\;\;\frac{z}{\frac{-a}{t}}\\
\mathbf{elif}\;z \cdot t \leq 10^{+257}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -5e307Initial program 69.7%
Taylor expanded in x around 0 80.2%
*-commutative80.2%
associate-*l/99.9%
associate-*r*99.9%
neg-mul-199.9%
distribute-frac-neg99.9%
Simplified99.9%
associate-*l/80.2%
associate-/l*99.9%
distribute-neg-frac99.9%
frac-2neg99.9%
distribute-neg-frac99.9%
remove-double-neg99.9%
distribute-neg-frac99.9%
Applied egg-rr99.9%
if -5e307 < (*.f64 z t) < 1.00000000000000003e257Initial program 95.2%
if 1.00000000000000003e257 < (*.f64 z t) Initial program 59.9%
Taylor expanded in x around 0 59.9%
*-commutative59.9%
associate-*l/94.7%
associate-*r*94.7%
neg-mul-194.7%
distribute-frac-neg94.7%
Simplified94.7%
Final simplification95.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* z t) 1e+257) (/ (fma x y (* z (- t))) a) (* t (/ (- z) a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= 1e+257) {
tmp = fma(x, y, (z * -t)) / a;
} else {
tmp = t * (-z / a);
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= 1e+257) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a); else tmp = Float64(t * Float64(Float64(-z) / a)); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], 1e+257], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq 10^{+257}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < 1.00000000000000003e257Initial program 93.1%
div-sub91.0%
*-commutative91.0%
div-sub93.1%
fma-neg94.0%
*-commutative94.0%
distribute-rgt-neg-out94.0%
Simplified94.0%
if 1.00000000000000003e257 < (*.f64 z t) Initial program 59.9%
Taylor expanded in x around 0 59.9%
*-commutative59.9%
associate-*l/94.7%
associate-*r*94.7%
neg-mul-194.7%
distribute-frac-neg94.7%
Simplified94.7%
Final simplification94.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* z t) -0.2)
(* t (/ (- z) a))
(if (<= (* z t) 5e-190)
(/ (* x y) a)
(if (<= (* z t) 40000.0) (* x (/ y a)) (/ (- t) (/ a z))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -0.2) {
tmp = t * (-z / a);
} else if ((z * t) <= 5e-190) {
tmp = (x * y) / a;
} else if ((z * t) <= 40000.0) {
tmp = x * (y / a);
} else {
tmp = -t / (a / z);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z * t) <= (-0.2d0)) then
tmp = t * (-z / a)
else if ((z * t) <= 5d-190) then
tmp = (x * y) / a
else if ((z * t) <= 40000.0d0) then
tmp = x * (y / a)
else
tmp = -t / (a / z)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -0.2) {
tmp = t * (-z / a);
} else if ((z * t) <= 5e-190) {
tmp = (x * y) / a;
} else if ((z * t) <= 40000.0) {
tmp = x * (y / a);
} else {
tmp = -t / (a / z);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -0.2: tmp = t * (-z / a) elif (z * t) <= 5e-190: tmp = (x * y) / a elif (z * t) <= 40000.0: tmp = x * (y / a) else: tmp = -t / (a / z) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= -0.2) tmp = Float64(t * Float64(Float64(-z) / a)); elseif (Float64(z * t) <= 5e-190) tmp = Float64(Float64(x * y) / a); elseif (Float64(z * t) <= 40000.0) tmp = Float64(x * Float64(y / a)); else tmp = Float64(Float64(-t) / Float64(a / z)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= -0.2)
tmp = t * (-z / a);
elseif ((z * t) <= 5e-190)
tmp = (x * y) / a;
elseif ((z * t) <= 40000.0)
tmp = x * (y / a);
else
tmp = -t / (a / z);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], -0.2], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-190], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 40000.0], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -0.2:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-190}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;z \cdot t \leq 40000:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\end{array}
\end{array}
if (*.f64 z t) < -0.20000000000000001Initial program 89.5%
Taylor expanded in x around 0 73.2%
*-commutative73.2%
associate-*l/74.9%
associate-*r*74.9%
neg-mul-174.9%
distribute-frac-neg74.9%
Simplified74.9%
if -0.20000000000000001 < (*.f64 z t) < 5.00000000000000034e-190Initial program 96.4%
Taylor expanded in x around inf 86.8%
if 5.00000000000000034e-190 < (*.f64 z t) < 4e4Initial program 84.0%
Taylor expanded in x around inf 59.5%
associate-*l/68.3%
Simplified68.3%
associate-*l/59.5%
clear-num59.5%
Applied egg-rr59.5%
associate-/r*67.3%
clear-num67.4%
associate-/r/69.2%
Applied egg-rr69.2%
if 4e4 < (*.f64 z t) Initial program 86.2%
Taylor expanded in x around 0 67.9%
mul-1-neg67.9%
associate-/l*77.1%
Simplified77.1%
Final simplification79.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -0.0008) (/ (* x y) a) (if (<= (* x y) 5e+45) (/ (- t) (/ a z)) (/ x (/ a y)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -0.0008) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e+45) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-0.0008d0)) then
tmp = (x * y) / a
else if ((x * y) <= 5d+45) then
tmp = -t / (a / z)
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -0.0008) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e+45) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -0.0008: tmp = (x * y) / a elif (x * y) <= 5e+45: tmp = -t / (a / z) else: tmp = x / (a / y) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -0.0008) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 5e+45) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -0.0008)
tmp = (x * y) / a;
elseif ((x * y) <= 5e+45)
tmp = -t / (a / z);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -0.0008], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+45], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -0.0008:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+45}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -8.00000000000000038e-4Initial program 89.3%
Taylor expanded in x around inf 76.1%
if -8.00000000000000038e-4 < (*.f64 x y) < 5e45Initial program 92.0%
Taylor expanded in x around 0 71.5%
mul-1-neg71.5%
associate-/l*72.7%
Simplified72.7%
if 5e45 < (*.f64 x y) Initial program 88.7%
Taylor expanded in x around inf 77.7%
associate-*l/81.3%
Simplified81.3%
associate-/r/78.1%
Applied egg-rr78.1%
Final simplification74.6%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2e-159) (/ (* x y) a) (/ x (/ a y))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-159) {
tmp = (x * y) / a;
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-2d-159)) then
tmp = (x * y) / a
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-159) {
tmp = (x * y) / a;
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e-159: tmp = (x * y) / a else: tmp = x / (a / y) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e-159) tmp = Float64(Float64(x * y) / a); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e-159)
tmp = (x * y) / a;
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e-159], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-159}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999998e-159Initial program 92.4%
Taylor expanded in x around inf 66.6%
if -1.99999999999999998e-159 < (*.f64 x y) Initial program 89.7%
Taylor expanded in x around inf 46.5%
associate-*l/46.3%
Simplified46.3%
associate-/r/47.0%
Applied egg-rr47.0%
Final simplification54.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y * (x / a)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return y * (x / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 90.7%
Taylor expanded in x around inf 53.7%
associate-*l/51.1%
Simplified51.1%
Final simplification51.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x * (y / a)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return x * (y / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 90.7%
Taylor expanded in x around inf 53.7%
associate-*l/51.1%
Simplified51.1%
associate-*l/53.7%
clear-num53.5%
Applied egg-rr53.5%
associate-/r*50.8%
clear-num50.8%
associate-/r/52.9%
Applied egg-rr52.9%
Final simplification52.9%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (/ x (/ a y)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return x / (a / y);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x / (a / y)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return x / (a / y);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return x / (a / y)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(x / Float64(a / y)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = x / (a / y);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\frac{x}{\frac{a}{y}}
\end{array}
Initial program 90.7%
Taylor expanded in x around inf 53.7%
associate-*l/51.1%
Simplified51.1%
associate-/r/52.4%
Applied egg-rr52.4%
Final simplification52.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023332
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:herbie-target
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))