
(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 12 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 80.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (/ (+ t_1 b) (* z c))))
(if (<= b -1.4e-62)
t_2
(if (<= b 9e+16) (/ (- t_1 (* (* (* z 4.0) t) a)) (* 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 + b) / (z * c);
double tmp;
if (b <= -1.4e-62) {
tmp = t_2;
} else if (b <= 9e+16) {
tmp = (t_1 - (((z * 4.0) * t) * a)) / (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 + b) / (z * c)
if (b <= (-1.4d-62)) then
tmp = t_2
else if (b <= 9d+16) then
tmp = (t_1 - (((z * 4.0d0) * t) * a)) / (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 + b) / (z * c);
double tmp;
if (b <= -1.4e-62) {
tmp = t_2;
} else if (b <= 9e+16) {
tmp = (t_1 - (((z * 4.0) * t) * a)) / (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 + b) / (z * c) tmp = 0 if b <= -1.4e-62: tmp = t_2 elif b <= 9e+16: tmp = (t_1 - (((z * 4.0) * t) * a)) / (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(Float64(t_1 + b) / Float64(z * c)) tmp = 0.0 if (b <= -1.4e-62) tmp = t_2; elseif (b <= 9e+16) tmp = Float64(Float64(t_1 - Float64(Float64(Float64(z * 4.0) * t) * a)) / 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 + b) / (z * c); tmp = 0.0; if (b <= -1.4e-62) tmp = t_2; elseif (b <= 9e+16) tmp = (t_1 - (((z * 4.0) * t) * a)) / (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[(N[(t$95$1 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.4e-62], t$95$2, If[LessEqual[b, 9e+16], N[(N[(t$95$1 - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $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 + b}{z \cdot c}\\
\mathbf{if}\;b \leq -1.4 \cdot 10^{-62}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;b \leq 9 \cdot 10^{+16}:\\
\;\;\;\;\frac{t\_1 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if b < -1.40000000000000001e-62 or 9e16 < b Initial program 81.3%
Taylor expanded in x around 0
Applied rewrites37.1%
Taylor expanded in x around 0
Applied rewrites23.2%
Taylor expanded in x around -inf
Applied rewrites74.1%
if -1.40000000000000001e-62 < b < 9e16Initial program 79.4%
Taylor expanded in x around 0
Applied rewrites76.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (+ (- (* x 9.0) (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= a -1.08e+144)
t_1
(if (<= a 1.9e+58) (/ (+ (* (* x 9.0) y) b) (* z c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (((x * 9.0) - (((z * 4.0) * t) * a)) + b) / (z * c);
double tmp;
if (a <= -1.08e+144) {
tmp = t_1;
} else if (a <= 1.9e+58) {
tmp = (((x * 9.0) * y) + b) / (z * c);
} else {
tmp = t_1;
}
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 = (((x * 9.0d0) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
if (a <= (-1.08d+144)) then
tmp = t_1
else if (a <= 1.9d+58) then
tmp = (((x * 9.0d0) * y) + b) / (z * c)
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 b, double c) {
double t_1 = (((x * 9.0) - (((z * 4.0) * t) * a)) + b) / (z * c);
double tmp;
if (a <= -1.08e+144) {
tmp = t_1;
} else if (a <= 1.9e+58) {
tmp = (((x * 9.0) * y) + b) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (((x * 9.0) - (((z * 4.0) * t) * a)) + b) / (z * c) tmp = 0 if a <= -1.08e+144: tmp = t_1 elif a <= 1.9e+58: tmp = (((x * 9.0) * y) + b) / (z * c) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(Float64(x * 9.0) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) tmp = 0.0 if (a <= -1.08e+144) tmp = t_1; elseif (a <= 1.9e+58) tmp = Float64(Float64(Float64(Float64(x * 9.0) * y) + b) / Float64(z * c)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (((x * 9.0) - (((z * 4.0) * t) * a)) + b) / (z * c); tmp = 0.0; if (a <= -1.08e+144) tmp = t_1; elseif (a <= 1.9e+58) tmp = (((x * 9.0) * y) + b) / (z * c); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(N[(x * 9.0), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.08e+144], t$95$1, If[LessEqual[a, 1.9e+58], N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(x \cdot 9 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\
\mathbf{if}\;a \leq -1.08 \cdot 10^{+144}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.9 \cdot 10^{+58}:\\
\;\;\;\;\frac{\left(x \cdot 9\right) \cdot y + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.0800000000000001e144 or 1.8999999999999999e58 < a Initial program 79.0%
Taylor expanded in x around 0
Applied rewrites60.3%
Taylor expanded in x around 0
Applied rewrites51.0%
Taylor expanded in y around inf
Applied rewrites66.2%
if -1.0800000000000001e144 < a < 1.8999999999999999e58Initial program 81.0%
Taylor expanded in x around 0
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites20.0%
Taylor expanded in x around -inf
Applied rewrites75.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (- (* x 9.0) (* (* (* z 4.0) t) a)) (* z c))))
(if (<= a -3.4e+144)
t_1
(if (<= a 1.55e+241) (/ (+ (* (* x 9.0) y) b) (* z c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((x * 9.0) - (((z * 4.0) * t) * a)) / (z * c);
double tmp;
if (a <= -3.4e+144) {
tmp = t_1;
} else if (a <= 1.55e+241) {
tmp = (((x * 9.0) * y) + b) / (z * c);
} else {
tmp = t_1;
}
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 = ((x * 9.0d0) - (((z * 4.0d0) * t) * a)) / (z * c)
if (a <= (-3.4d+144)) then
tmp = t_1
else if (a <= 1.55d+241) then
tmp = (((x * 9.0d0) * y) + b) / (z * c)
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 b, double c) {
double t_1 = ((x * 9.0) - (((z * 4.0) * t) * a)) / (z * c);
double tmp;
if (a <= -3.4e+144) {
tmp = t_1;
} else if (a <= 1.55e+241) {
tmp = (((x * 9.0) * y) + b) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = ((x * 9.0) - (((z * 4.0) * t) * a)) / (z * c) tmp = 0 if a <= -3.4e+144: tmp = t_1 elif a <= 1.55e+241: tmp = (((x * 9.0) * y) + b) / (z * c) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(x * 9.0) - Float64(Float64(Float64(z * 4.0) * t) * a)) / Float64(z * c)) tmp = 0.0 if (a <= -3.4e+144) tmp = t_1; elseif (a <= 1.55e+241) tmp = Float64(Float64(Float64(Float64(x * 9.0) * y) + b) / Float64(z * c)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = ((x * 9.0) - (((z * 4.0) * t) * a)) / (z * c); tmp = 0.0; if (a <= -3.4e+144) tmp = t_1; elseif (a <= 1.55e+241) tmp = (((x * 9.0) * y) + b) / (z * c); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(x * 9.0), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.4e+144], t$95$1, If[LessEqual[a, 1.55e+241], N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot 9 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a}{z \cdot c}\\
\mathbf{if}\;a \leq -3.4 \cdot 10^{+144}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.55 \cdot 10^{+241}:\\
\;\;\;\;\frac{\left(x \cdot 9\right) \cdot y + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.3999999999999999e144 or 1.55e241 < a Initial program 79.9%
Taylor expanded in x around 0
Applied rewrites67.6%
Taylor expanded in x around 0
Applied rewrites60.1%
if -3.3999999999999999e144 < a < 1.55e241Initial program 80.4%
Taylor expanded in x around 0
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites24.8%
Taylor expanded in x around -inf
Applied rewrites69.9%
(FPCore (x y z t a b c) :precision binary64 (/ (+ (* (* x 9.0) y) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * 9.0) * y) + 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) + 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) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return (((x * 9.0) * y) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * 9.0) * y) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * 9.0) * y) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot 9\right) \cdot y + b}{z \cdot c}
\end{array}
Initial program 80.4%
Taylor expanded in x around 0
Applied rewrites56.2%
Taylor expanded in x around 0
Applied rewrites30.2%
Taylor expanded in x around -inf
Applied rewrites63.8%
(FPCore (x y z t a b c) :precision binary64 (if (<= y -2.12e+245) (* (* x 9.0) 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 <= -2.12e+245) {
tmp = (x * 9.0) * 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 <= (-2.12d+245)) then
tmp = (x * 9.0d0) * 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 <= -2.12e+245) {
tmp = (x * 9.0) * y;
} else {
tmp = (x * 9.0) / (z * c);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if y <= -2.12e+245: tmp = (x * 9.0) * y else: tmp = (x * 9.0) / (z * c) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (y <= -2.12e+245) tmp = Float64(Float64(x * 9.0) * 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 <= -2.12e+245) tmp = (x * 9.0) * y; else tmp = (x * 9.0) / (z * c); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[y, -2.12e+245], N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(x * 9.0), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.12 \cdot 10^{+245}:\\
\;\;\;\;\left(x \cdot 9\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 9}{z \cdot c}\\
\end{array}
\end{array}
if y < -2.1199999999999999e245Initial program 83.4%
Taylor expanded in x around 0
Applied rewrites34.6%
Taylor expanded in x around 0
Applied rewrites43.0%
if -2.1199999999999999e245 < y Initial program 80.2%
Taylor expanded in x around 0
Applied rewrites35.8%
Taylor expanded in x around 0
Applied rewrites13.9%
(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 80.4%
Taylor expanded in x around 0
Applied rewrites38.4%
(FPCore (x y z t a b c) :precision binary64 (if (<= y -7.8e+75) (+ (* (* x 9.0) y) b) (* (* (* z 4.0) t) a)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (y <= -7.8e+75) {
tmp = ((x * 9.0) * y) + b;
} else {
tmp = ((z * 4.0) * t) * a;
}
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 <= (-7.8d+75)) then
tmp = ((x * 9.0d0) * y) + b
else
tmp = ((z * 4.0d0) * t) * a
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 <= -7.8e+75) {
tmp = ((x * 9.0) * y) + b;
} else {
tmp = ((z * 4.0) * t) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if y <= -7.8e+75: tmp = ((x * 9.0) * y) + b else: tmp = ((z * 4.0) * t) * a return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (y <= -7.8e+75) tmp = Float64(Float64(Float64(x * 9.0) * y) + b); else tmp = Float64(Float64(Float64(z * 4.0) * t) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (y <= -7.8e+75) tmp = ((x * 9.0) * y) + b; else tmp = ((z * 4.0) * t) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[y, -7.8e+75], N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision], N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+75}:\\
\;\;\;\;\left(x \cdot 9\right) \cdot y + b\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot 4\right) \cdot t\right) \cdot a\\
\end{array}
\end{array}
if y < -7.80000000000000075e75Initial program 71.7%
Taylor expanded in x around 0
Applied rewrites16.5%
Taylor expanded in x around 0
Applied rewrites16.7%
if -7.80000000000000075e75 < y Initial program 82.3%
Taylor expanded in x around 0
Applied rewrites7.9%
Taylor expanded in x around -inf
Applied rewrites7.9%
(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 80.4%
Taylor expanded in x around 0
Applied rewrites9.5%
Taylor expanded in x around 0
Applied rewrites7.0%
(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 80.4%
Taylor expanded in x around 0
Applied rewrites9.5%
Taylor expanded in x around 0
Applied rewrites7.0%
(FPCore (x y z t a b c) :precision binary64 (+ (* x 9.0) b))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (x * 9.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 = (x * 9.0d0) + 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) + b;
}
def code(x, y, z, t, a, b, c): return (x * 9.0) + b
function code(x, y, z, t, a, b, c) return Float64(Float64(x * 9.0) + b) end
function tmp = code(x, y, z, t, a, b, c) tmp = (x * 9.0) + b; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(x * 9.0), $MachinePrecision] + b), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 9 + b
\end{array}
Initial program 80.4%
Taylor expanded in x around 0
Applied rewrites9.5%
Taylor expanded in x around 0
Applied rewrites34.5%
Taylor expanded in x around -inf
Applied rewrites3.4%
(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 80.4%
Taylor expanded in x around 0
Applied rewrites9.5%
Taylor expanded in x around 0
Applied rewrites34.5%
Taylor expanded in x around -inf
Applied rewrites3.3%
(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 2024313
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
: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)))