
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
Initial program 74.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* (* z 4.0) t) a))
(t_2 (* (* x 9.0) y))
(t_3 (/ t_2 (* z c))))
(if (<= t_2 -2e+40)
t_3
(if (<= t_2 5e-205)
(/ (+ t_1 b) (* z c))
(if (<= t_2 2e-10) (/ (- (* x 9.0) t_1) (* z c)) t_3)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((z * 4.0) * t) * a;
double t_2 = (x * 9.0) * y;
double t_3 = t_2 / (z * c);
double tmp;
if (t_2 <= -2e+40) {
tmp = t_3;
} else if (t_2 <= 5e-205) {
tmp = (t_1 + b) / (z * c);
} else if (t_2 <= 2e-10) {
tmp = ((x * 9.0) - t_1) / (z * c);
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = ((z * 4.0d0) * t) * a
t_2 = (x * 9.0d0) * y
t_3 = t_2 / (z * c)
if (t_2 <= (-2d+40)) then
tmp = t_3
else if (t_2 <= 5d-205) then
tmp = (t_1 + b) / (z * c)
else if (t_2 <= 2d-10) then
tmp = ((x * 9.0d0) - t_1) / (z * c)
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((z * 4.0) * t) * a;
double t_2 = (x * 9.0) * y;
double t_3 = t_2 / (z * c);
double tmp;
if (t_2 <= -2e+40) {
tmp = t_3;
} else if (t_2 <= 5e-205) {
tmp = (t_1 + b) / (z * c);
} else if (t_2 <= 2e-10) {
tmp = ((x * 9.0) - t_1) / (z * c);
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = ((z * 4.0) * t) * a t_2 = (x * 9.0) * y t_3 = t_2 / (z * c) tmp = 0 if t_2 <= -2e+40: tmp = t_3 elif t_2 <= 5e-205: tmp = (t_1 + b) / (z * c) elif t_2 <= 2e-10: tmp = ((x * 9.0) - t_1) / (z * c) else: tmp = t_3 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(z * 4.0) * t) * a) t_2 = Float64(Float64(x * 9.0) * y) t_3 = Float64(t_2 / Float64(z * c)) tmp = 0.0 if (t_2 <= -2e+40) tmp = t_3; elseif (t_2 <= 5e-205) tmp = Float64(Float64(t_1 + b) / Float64(z * c)); elseif (t_2 <= 2e-10) tmp = Float64(Float64(Float64(x * 9.0) - t_1) / Float64(z * c)); else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = ((z * 4.0) * t) * a; t_2 = (x * 9.0) * y; t_3 = t_2 / (z * c); tmp = 0.0; if (t_2 <= -2e+40) tmp = t_3; elseif (t_2 <= 5e-205) tmp = (t_1 + b) / (z * c); elseif (t_2 <= 2e-10) tmp = ((x * 9.0) - t_1) / (z * c); else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+40], t$95$3, If[LessEqual[t$95$2, 5e-205], N[(N[(t$95$1 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-10], N[(N[(N[(x * 9.0), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\\
t_2 := \left(x \cdot 9\right) \cdot y\\
t_3 := \frac{t\_2}{z \cdot c}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+40}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-205}:\\
\;\;\;\;\frac{t\_1 + b}{z \cdot c}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{x \cdot 9 - t\_1}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000006e40 or 2.00000000000000007e-10 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 75.5%
Taylor expanded in x around 0
Applied rewrites58.4%
if -2.00000000000000006e40 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000001e-205Initial program 73.7%
Taylor expanded in x around 0
Applied rewrites47.5%
if 5.00000000000000001e-205 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.00000000000000007e-10Initial program 72.6%
Taylor expanded in x around 0
Applied rewrites51.2%
Taylor expanded in x around 0
Applied rewrites37.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (/ t_1 (* z c))))
(if (<= t_1 -2e+40)
t_2
(if (<= t_1 2e-73) (/ (+ (* (* (* z 4.0) t) a) b) (* z c)) t_2))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = t_1 / (z * c);
double tmp;
if (t_1 <= -2e+40) {
tmp = t_2;
} else if (t_1 <= 2e-73) {
tmp = ((((z * 4.0) * t) * a) + b) / (z * c);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = t_1 / (z * c)
if (t_1 <= (-2d+40)) then
tmp = t_2
else if (t_1 <= 2d-73) then
tmp = ((((z * 4.0d0) * t) * a) + b) / (z * c)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = t_1 / (z * c);
double tmp;
if (t_1 <= -2e+40) {
tmp = t_2;
} else if (t_1 <= 2e-73) {
tmp = ((((z * 4.0) * t) * a) + b) / (z * c);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = t_1 / (z * c) tmp = 0 if t_1 <= -2e+40: tmp = t_2 elif t_1 <= 2e-73: tmp = ((((z * 4.0) * t) * a) + b) / (z * c) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(t_1 / Float64(z * c)) tmp = 0.0 if (t_1 <= -2e+40) tmp = t_2; elseif (t_1 <= 2e-73) tmp = Float64(Float64(Float64(Float64(Float64(z * 4.0) * t) * a) + b) / Float64(z * c)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (x * 9.0) * y; t_2 = t_1 / (z * c); tmp = 0.0; if (t_1 <= -2e+40) tmp = t_2; elseif (t_1 <= 2e-73) tmp = ((((z * 4.0) * t) * a) + b) / (z * c); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+40], t$95$2, If[LessEqual[t$95$1, 2e-73], N[(N[(N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \frac{t\_1}{z \cdot c}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+40}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-73}:\\
\;\;\;\;\frac{\left(\left(z \cdot 4\right) \cdot t\right) \cdot a + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000006e40 or 1.99999999999999999e-73 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 76.2%
Taylor expanded in x around 0
Applied rewrites54.4%
if -2.00000000000000006e40 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999999e-73Initial program 72.1%
Taylor expanded in x around 0
Applied rewrites44.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* (* z 4.0) t) a)))
(if (<= b 1.1e+216)
(/ (- (* (* x 9.0) y) t_1) (* z c))
(/ (+ t_1 b) (* z c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((z * 4.0) * t) * a;
double tmp;
if (b <= 1.1e+216) {
tmp = (((x * 9.0) * y) - t_1) / (z * c);
} else {
tmp = (t_1 + b) / (z * c);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = ((z * 4.0d0) * t) * a
if (b <= 1.1d+216) then
tmp = (((x * 9.0d0) * y) - t_1) / (z * c)
else
tmp = (t_1 + b) / (z * c)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((z * 4.0) * t) * a;
double tmp;
if (b <= 1.1e+216) {
tmp = (((x * 9.0) * y) - t_1) / (z * c);
} else {
tmp = (t_1 + b) / (z * c);
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = ((z * 4.0) * t) * a tmp = 0 if b <= 1.1e+216: tmp = (((x * 9.0) * y) - t_1) / (z * c) else: tmp = (t_1 + b) / (z * c) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(z * 4.0) * t) * a) tmp = 0.0 if (b <= 1.1e+216) tmp = Float64(Float64(Float64(Float64(x * 9.0) * y) - t_1) / Float64(z * c)); else tmp = Float64(Float64(t_1 + b) / Float64(z * c)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = ((z * 4.0) * t) * a; tmp = 0.0; if (b <= 1.1e+216) tmp = (((x * 9.0) * y) - t_1) / (z * c); else tmp = (t_1 + b) / (z * c); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[b, 1.1e+216], N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\\
\mathbf{if}\;b \leq 1.1 \cdot 10^{+216}:\\
\;\;\;\;\frac{\left(x \cdot 9\right) \cdot y - t\_1}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1 + b}{z \cdot c}\\
\end{array}
\end{array}
if b < 1.1e216Initial program 74.8%
Taylor expanded in x around 0
Applied rewrites59.7%
if 1.1e216 < b Initial program 70.5%
Taylor expanded in x around 0
Applied rewrites65.4%
(FPCore (x y z t a b c) :precision binary64 (if (<= y -8e-303) (* (* (* x 9.0) y) y) (/ (* x 9.0) (* z c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (y <= -8e-303) {
tmp = ((x * 9.0) * y) * y;
} else {
tmp = (x * 9.0) / (z * c);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (y <= (-8d-303)) then
tmp = ((x * 9.0d0) * y) * y
else
tmp = (x * 9.0d0) / (z * c)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (y <= -8e-303) {
tmp = ((x * 9.0) * y) * y;
} else {
tmp = (x * 9.0) / (z * c);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if y <= -8e-303: tmp = ((x * 9.0) * y) * y else: tmp = (x * 9.0) / (z * c) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (y <= -8e-303) tmp = Float64(Float64(Float64(x * 9.0) * y) * y); else tmp = Float64(Float64(x * 9.0) / Float64(z * c)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (y <= -8e-303) tmp = ((x * 9.0) * y) * y; else tmp = (x * 9.0) / (z * c); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[y, -8e-303], N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision], N[(N[(x * 9.0), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-303}:\\
\;\;\;\;\left(\left(x \cdot 9\right) \cdot y\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 9}{z \cdot c}\\
\end{array}
\end{array}
if y < -7.99999999999999944e-303Initial program 75.6%
Taylor expanded in x around 0
Applied rewrites8.9%
Taylor expanded in x around 0
Applied rewrites5.5%
Taylor expanded in x around 0
Applied rewrites11.8%
if -7.99999999999999944e-303 < y Initial program 73.5%
Taylor expanded in x around 0
Applied rewrites35.4%
Taylor expanded in x around 0
Applied rewrites19.7%
(FPCore (x y z t a b c) :precision binary64 (/ (* (* x 9.0) y) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((x * 9.0) * y) / (z * c);
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((x * 9.0d0) * y) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((x * 9.0) * y) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((x * 9.0) * y) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(x * 9.0) * y) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((x * 9.0) * y) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot 9\right) \cdot y}{z \cdot c}
\end{array}
Initial program 74.5%
Taylor expanded in x around 0
Applied rewrites36.1%
(FPCore (x y z t a b c) :precision binary64 (* (* (* x 9.0) y) y))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((x * 9.0) * y) * y;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((x * 9.0d0) * y) * y
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((x * 9.0) * y) * y;
}
def code(x, y, z, t, a, b, c): return ((x * 9.0) * y) * y
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(x * 9.0) * y) * y) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((x * 9.0) * y) * y; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 9\right) \cdot y\right) \cdot y
\end{array}
Initial program 74.5%
Taylor expanded in x around 0
Applied rewrites9.3%
Taylor expanded in x around 0
Applied rewrites5.7%
Taylor expanded in x around 0
Applied rewrites10.0%
(FPCore (x y z t a b c) :precision binary64 (+ (* (* x 9.0) y) b))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((x * 9.0) * y) + b;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((x * 9.0d0) * y) + b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((x * 9.0) * y) + b;
}
def code(x, y, z, t, a, b, c): return ((x * 9.0) * y) + b
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(x * 9.0) * y) + b) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((x * 9.0) * y) + b; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 9\right) \cdot y + b
\end{array}
Initial program 74.5%
Taylor expanded in x around 0
Applied rewrites9.3%
Taylor expanded in x around 0
Applied rewrites6.1%
(FPCore (x y z t a b c) :precision binary64 (* (* x 9.0) y))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (x * 9.0) * y;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = (x * 9.0d0) * y
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (x * 9.0) * y;
}
def code(x, y, z, t, a, b, c): return (x * 9.0) * y
function code(x, y, z, t, a, b, c) return Float64(Float64(x * 9.0) * y) end
function tmp = code(x, y, z, t, a, b, c) tmp = (x * 9.0) * y; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 9\right) \cdot y
\end{array}
Initial program 74.5%
Taylor expanded in x around 0
Applied rewrites9.3%
Taylor expanded in x around 0
Applied rewrites5.7%
(FPCore (x y z t a b c) :precision binary64 (+ (* z 4.0) b))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (z * 4.0) + b;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = (z * 4.0d0) + b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (z * 4.0) + b;
}
def code(x, y, z, t, a, b, c): return (z * 4.0) + b
function code(x, y, z, t, a, b, c) return Float64(Float64(z * 4.0) + b) end
function tmp = code(x, y, z, t, a, b, c) tmp = (z * 4.0) + b; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(z * 4.0), $MachinePrecision] + b), $MachinePrecision]
\begin{array}{l}
\\
z \cdot 4 + b
\end{array}
Initial program 74.5%
Taylor expanded in x around 0
Applied rewrites9.3%
Taylor expanded in x around 0
Applied rewrites31.4%
Taylor expanded in x around 0
Applied rewrites3.1%
(FPCore (x y z t a b c) :precision binary64 (* x 9.0))
double code(double x, double y, double z, double t, double a, double b, double c) {
return x * 9.0;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = x * 9.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return x * 9.0;
}
def code(x, y, z, t, a, b, c): return x * 9.0
function code(x, y, z, t, a, b, c) return Float64(x * 9.0) end
function tmp = code(x, y, z, t, a, b, c) tmp = x * 9.0; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * 9.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 9
\end{array}
Initial program 74.5%
Taylor expanded in x around 0
Applied rewrites9.3%
Taylor expanded in x around 0
Applied rewrites31.4%
Taylor expanded in y around -inf
Applied rewrites3.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ b (* c z)))
(t_2 (* 4.0 (/ (* a t) c)))
(t_3 (* (* x 9.0) y))
(t_4 (+ (- t_3 (* (* (* z 4.0) t) a)) b))
(t_5 (/ t_4 (* z c)))
(t_6 (/ (+ (- t_3 (* (* z 4.0) (* t a))) b) (* z c))))
(if (< t_5 -1.100156740804105e-171)
t_6
(if (< t_5 0.0)
(/ (/ t_4 z) c)
(if (< t_5 1.1708877911747488e-53)
t_6
(if (< t_5 2.876823679546137e+130)
(- (+ (* (* 9.0 (/ y c)) (/ x z)) t_1) t_2)
(if (< t_5 1.3838515042456319e+158)
t_6
(- (+ (* 9.0 (* (/ y (* c z)) x)) t_1) t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (c * z);
double t_2 = 4.0 * ((a * t) / c);
double t_3 = (x * 9.0) * y;
double t_4 = (t_3 - (((z * 4.0) * t) * a)) + b;
double t_5 = t_4 / (z * c);
double t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c);
double tmp;
if (t_5 < -1.100156740804105e-171) {
tmp = t_6;
} else if (t_5 < 0.0) {
tmp = (t_4 / z) / c;
} else if (t_5 < 1.1708877911747488e-53) {
tmp = t_6;
} else if (t_5 < 2.876823679546137e+130) {
tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2;
} else if (t_5 < 1.3838515042456319e+158) {
tmp = t_6;
} else {
tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = b / (c * z)
t_2 = 4.0d0 * ((a * t) / c)
t_3 = (x * 9.0d0) * y
t_4 = (t_3 - (((z * 4.0d0) * t) * a)) + b
t_5 = t_4 / (z * c)
t_6 = ((t_3 - ((z * 4.0d0) * (t * a))) + b) / (z * c)
if (t_5 < (-1.100156740804105d-171)) then
tmp = t_6
else if (t_5 < 0.0d0) then
tmp = (t_4 / z) / c
else if (t_5 < 1.1708877911747488d-53) then
tmp = t_6
else if (t_5 < 2.876823679546137d+130) then
tmp = (((9.0d0 * (y / c)) * (x / z)) + t_1) - t_2
else if (t_5 < 1.3838515042456319d+158) then
tmp = t_6
else
tmp = ((9.0d0 * ((y / (c * z)) * x)) + t_1) - t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (c * z);
double t_2 = 4.0 * ((a * t) / c);
double t_3 = (x * 9.0) * y;
double t_4 = (t_3 - (((z * 4.0) * t) * a)) + b;
double t_5 = t_4 / (z * c);
double t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c);
double tmp;
if (t_5 < -1.100156740804105e-171) {
tmp = t_6;
} else if (t_5 < 0.0) {
tmp = (t_4 / z) / c;
} else if (t_5 < 1.1708877911747488e-53) {
tmp = t_6;
} else if (t_5 < 2.876823679546137e+130) {
tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2;
} else if (t_5 < 1.3838515042456319e+158) {
tmp = t_6;
} else {
tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = b / (c * z) t_2 = 4.0 * ((a * t) / c) t_3 = (x * 9.0) * y t_4 = (t_3 - (((z * 4.0) * t) * a)) + b t_5 = t_4 / (z * c) t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c) tmp = 0 if t_5 < -1.100156740804105e-171: tmp = t_6 elif t_5 < 0.0: tmp = (t_4 / z) / c elif t_5 < 1.1708877911747488e-53: tmp = t_6 elif t_5 < 2.876823679546137e+130: tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2 elif t_5 < 1.3838515042456319e+158: tmp = t_6 else: tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(b / Float64(c * z)) t_2 = Float64(4.0 * Float64(Float64(a * t) / c)) t_3 = Float64(Float64(x * 9.0) * y) t_4 = Float64(Float64(t_3 - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) t_5 = Float64(t_4 / Float64(z * c)) t_6 = Float64(Float64(Float64(t_3 - Float64(Float64(z * 4.0) * Float64(t * a))) + b) / Float64(z * c)) tmp = 0.0 if (t_5 < -1.100156740804105e-171) tmp = t_6; elseif (t_5 < 0.0) tmp = Float64(Float64(t_4 / z) / c); elseif (t_5 < 1.1708877911747488e-53) tmp = t_6; elseif (t_5 < 2.876823679546137e+130) tmp = Float64(Float64(Float64(Float64(9.0 * Float64(y / c)) * Float64(x / z)) + t_1) - t_2); elseif (t_5 < 1.3838515042456319e+158) tmp = t_6; else tmp = Float64(Float64(Float64(9.0 * Float64(Float64(y / Float64(c * z)) * x)) + t_1) - t_2); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = b / (c * z); t_2 = 4.0 * ((a * t) / c); t_3 = (x * 9.0) * y; t_4 = (t_3 - (((z * 4.0) * t) * a)) + b; t_5 = t_4 / (z * c); t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c); tmp = 0.0; if (t_5 < -1.100156740804105e-171) tmp = t_6; elseif (t_5 < 0.0) tmp = (t_4 / z) / c; elseif (t_5 < 1.1708877911747488e-53) tmp = t_6; elseif (t_5 < 2.876823679546137e+130) tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2; elseif (t_5 < 1.3838515042456319e+158) tmp = t_6; else tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 / N[(z * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$3 - N[(N[(z * 4.0), $MachinePrecision] * N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$5, -1.100156740804105e-171], t$95$6, If[Less[t$95$5, 0.0], N[(N[(t$95$4 / z), $MachinePrecision] / c), $MachinePrecision], If[Less[t$95$5, 1.1708877911747488e-53], t$95$6, If[Less[t$95$5, 2.876823679546137e+130], N[(N[(N[(N[(9.0 * N[(y / c), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], If[Less[t$95$5, 1.3838515042456319e+158], t$95$6, N[(N[(N[(9.0 * N[(N[(y / N[(c * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{b}{c \cdot z}\\
t_2 := 4 \cdot \frac{a \cdot t}{c}\\
t_3 := \left(x \cdot 9\right) \cdot y\\
t_4 := \left(t\_3 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b\\
t_5 := \frac{t\_4}{z \cdot c}\\
t_6 := \frac{\left(t\_3 - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\
\mathbf{if}\;t\_5 < -1.100156740804105 \cdot 10^{-171}:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 < 0:\\
\;\;\;\;\frac{\frac{t\_4}{z}}{c}\\
\mathbf{elif}\;t\_5 < 1.1708877911747488 \cdot 10^{-53}:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 < 2.876823679546137 \cdot 10^{+130}:\\
\;\;\;\;\left(\left(9 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + t\_1\right) - t\_2\\
\mathbf{elif}\;t\_5 < 1.3838515042456319 \cdot 10^{+158}:\\
\;\;\;\;t\_6\\
\mathbf{else}:\\
\;\;\;\;\left(9 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + t\_1\right) - t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024321
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
:pre (TRUE)
:alt
(! :herbie-platform default (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -220031348160821/200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 0) (/ (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 365902434742109/31250000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 28768236795461370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 138385150424563190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (- (+ (* 9 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4 (/ (* a t) c)))))))))
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))