
(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(x - Float64(Float64(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[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 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(x - Float64(Float64(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[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- z t))))
(if (<= t_1 -5e+106)
(fma (- t z) (/ y a) x)
(if (<= t_1 2e+293)
(- x (/ (fma (- t) y (* z y)) a))
(* (/ (- t z) a) y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -5e+106) {
tmp = fma((t - z), (y / a), x);
} else if (t_1 <= 2e+293) {
tmp = x - (fma(-t, y, (z * y)) / a);
} else {
tmp = ((t - z) / a) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+106) tmp = fma(Float64(t - z), Float64(y / a), x); elseif (t_1 <= 2e+293) tmp = Float64(x - Float64(fma(Float64(-t), y, Float64(z * y)) / a)); else tmp = Float64(Float64(Float64(t - z) / a) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+106], N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+293], N[(x - N[(N[((-t) * y + N[(z * y), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(t - z, \frac{y}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+293}:\\
\;\;\;\;x - \frac{\mathsf{fma}\left(-t, y, z \cdot y\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - z}{a} \cdot y\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -4.9999999999999998e106Initial program 85.5%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
if -4.9999999999999998e106 < (*.f64 y (-.f64 z t)) < 1.9999999999999998e293Initial program 99.8%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
if 1.9999999999999998e293 < (*.f64 y (-.f64 z t)) Initial program 53.3%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)))
(if (or (<= t_1 -1e+69) (not (<= t_1 1e+116)))
(* (/ (- t z) a) y)
(fma (/ t a) y x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double tmp;
if ((t_1 <= -1e+69) || !(t_1 <= 1e+116)) {
tmp = ((t - z) / a) * y;
} else {
tmp = fma((t / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) tmp = 0.0 if ((t_1 <= -1e+69) || !(t_1 <= 1e+116)) tmp = Float64(Float64(Float64(t - z) / a) * y); else tmp = fma(Float64(t / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+69], N[Not[LessEqual[t$95$1, 1e+116]], $MachinePrecision]], N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+69} \lor \neg \left(t\_1 \leq 10^{+116}\right):\\
\;\;\;\;\frac{t - z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -1.0000000000000001e69 or 1.00000000000000002e116 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 84.7%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6496.3
Applied rewrites96.3%
Taylor expanded in x around 0
Applied rewrites86.3%
if -1.0000000000000001e69 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1.00000000000000002e116Initial program 99.9%
Taylor expanded in z around 0
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
Final simplification86.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)))
(if (<= t_1 -1e+69)
(* (/ (- t z) a) y)
(if (<= t_1 1e+116) (fma (/ t a) y x) (* (- t z) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double tmp;
if (t_1 <= -1e+69) {
tmp = ((t - z) / a) * y;
} else if (t_1 <= 1e+116) {
tmp = fma((t / a), y, x);
} else {
tmp = (t - z) * (y / a);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) tmp = 0.0 if (t_1 <= -1e+69) tmp = Float64(Float64(Float64(t - z) / a) * y); elseif (t_1 <= 1e+116) tmp = fma(Float64(t / a), y, x); else tmp = Float64(Float64(t - z) * Float64(y / a)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+69], N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 1e+116], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+69}:\\
\;\;\;\;\frac{t - z}{a} \cdot y\\
\mathbf{elif}\;t\_1 \leq 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t - z\right) \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -1.0000000000000001e69Initial program 87.1%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6496.1
Applied rewrites96.1%
Taylor expanded in x around 0
Applied rewrites85.0%
if -1.0000000000000001e69 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1.00000000000000002e116Initial program 99.9%
Taylor expanded in z around 0
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
if 1.00000000000000002e116 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 81.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6489.7
Applied rewrites89.7%
Final simplification86.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- z t))))
(if (<= t_1 -5e+106)
(fma (- t z) (/ y a) x)
(if (<= t_1 2e+293) (- x (/ t_1 a)) (* (/ (- t z) a) y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -5e+106) {
tmp = fma((t - z), (y / a), x);
} else if (t_1 <= 2e+293) {
tmp = x - (t_1 / a);
} else {
tmp = ((t - z) / a) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+106) tmp = fma(Float64(t - z), Float64(y / a), x); elseif (t_1 <= 2e+293) tmp = Float64(x - Float64(t_1 / a)); else tmp = Float64(Float64(Float64(t - z) / a) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+106], N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+293], N[(x - N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(t - z, \frac{y}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+293}:\\
\;\;\;\;x - \frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - z}{a} \cdot y\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -4.9999999999999998e106Initial program 85.5%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
if -4.9999999999999998e106 < (*.f64 y (-.f64 z t)) < 1.9999999999999998e293Initial program 99.8%
if 1.9999999999999998e293 < (*.f64 y (-.f64 z t)) Initial program 53.3%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.9%
Final simplification99.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.5e-50) (not (<= z 6e+145))) (- x (* (/ y a) z)) (fma (/ t a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.5e-50) || !(z <= 6e+145)) {
tmp = x - ((y / a) * z);
} else {
tmp = fma((t / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.5e-50) || !(z <= 6e+145)) tmp = Float64(x - Float64(Float64(y / a) * z)); else tmp = fma(Float64(t / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.5e-50], N[Not[LessEqual[z, 6e+145]], $MachinePrecision]], N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-50} \lor \neg \left(z \leq 6 \cdot 10^{+145}\right):\\
\;\;\;\;x - \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -1.49999999999999995e-50 or 6.0000000000000005e145 < z Initial program 86.5%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.9
Applied rewrites84.9%
Applied rewrites88.5%
if -1.49999999999999995e-50 < z < 6.0000000000000005e145Initial program 96.2%
Taylor expanded in z around 0
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
Final simplification89.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.85e+19) (not (<= z 2.7e+158))) (* (/ (- z) a) y) (fma (/ y a) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.85e+19) || !(z <= 2.7e+158)) {
tmp = (-z / a) * y;
} else {
tmp = fma((y / a), t, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.85e+19) || !(z <= 2.7e+158)) tmp = Float64(Float64(Float64(-z) / a) * y); else tmp = fma(Float64(y / a), t, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.85e+19], N[Not[LessEqual[z, 2.7e+158]], $MachinePrecision]], N[(N[((-z) / a), $MachinePrecision] * y), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+19} \lor \neg \left(z \leq 2.7 \cdot 10^{+158}\right):\\
\;\;\;\;\frac{-z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\end{array}
\end{array}
if z < -1.85e19 or 2.69999999999999979e158 < z Initial program 84.6%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r/N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6466.2
Applied rewrites66.2%
Applied rewrites65.3%
if -1.85e19 < z < 2.69999999999999979e158Initial program 96.5%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
Taylor expanded in z around 0
Applied rewrites89.4%
Final simplification80.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.85e+19) (* (- z) (/ y a)) (if (<= z 2.7e+158) (fma (/ y a) t x) (* (/ (- z) a) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.85e+19) {
tmp = -z * (y / a);
} else if (z <= 2.7e+158) {
tmp = fma((y / a), t, x);
} else {
tmp = (-z / a) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.85e+19) tmp = Float64(Float64(-z) * Float64(y / a)); elseif (z <= 2.7e+158) tmp = fma(Float64(y / a), t, x); else tmp = Float64(Float64(Float64(-z) / a) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.85e+19], N[((-z) * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+158], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(N[((-z) / a), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+19}:\\
\;\;\;\;\left(-z\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{a} \cdot y\\
\end{array}
\end{array}
if z < -1.85e19Initial program 83.5%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r/N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6464.5
Applied rewrites64.5%
if -1.85e19 < z < 2.69999999999999979e158Initial program 96.5%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
Taylor expanded in z around 0
Applied rewrites89.4%
if 2.69999999999999979e158 < z Initial program 87.0%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r/N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6469.9
Applied rewrites69.9%
Applied rewrites73.3%
Final simplification81.4%
(FPCore (x y z t a) :precision binary64 (- x (/ y (/ a (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x - (y / (a / (z - t)));
}
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 / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (y / (a / (z - t)));
}
def code(x, y, z, t, a): return x - (y / (a / (z - t)))
function code(x, y, z, t, a) return Float64(x - Float64(y / Float64(a / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x - (y / (a / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{\frac{a}{z - t}}
\end{array}
Initial program 92.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
(FPCore (x y z t a) :precision binary64 (fma (- t z) (/ y a) x))
double code(double x, double y, double z, double t, double a) {
return fma((t - z), (y / a), x);
}
function code(x, y, z, t, a) return fma(Float64(t - z), Float64(y / a), x) end
code[x_, y_, z_, t_, a_] := N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(t - z, \frac{y}{a}, x\right)
\end{array}
Initial program 92.2%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6496.6
Applied rewrites96.6%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) t x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), t, x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, t, x\right)
\end{array}
Initial program 92.2%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6496.6
Applied rewrites96.6%
Taylor expanded in z around 0
Applied rewrites71.7%
Final simplification71.7%
(FPCore (x y z t a) :precision binary64 (* t (/ y a)))
double code(double x, double y, double z, double t, double a) {
return t * (y / 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 = t * (y / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return t * (y / a);
}
def code(x, y, z, t, a): return t * (y / a)
function code(x, y, z, t, a) return Float64(t * Float64(y / a)) end
function tmp = code(x, y, z, t, a) tmp = t * (y / a); end
code[x_, y_, z_, t_, a_] := N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \frac{y}{a}
\end{array}
Initial program 92.2%
Taylor expanded in t around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6432.1
Applied rewrites32.1%
Applied rewrites32.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(- x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(- x (/ (* y (- z t)) a))
(- x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / 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 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x - (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x - ((y * (z - t)) / a)
else
tmp = x - (y / 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 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x - (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x - ((y * (z - t)) / a) else: tmp = x - (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x - Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x - Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x - (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x - ((y * (z - t)) / a); else tmp = x - (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x - N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{1}{\frac{t\_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024317
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:alt
(! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t)))))))
(- x (/ (* y (- z t)) a)))