(FPCore (x y) :precision binary64 (* (* (* x 3.0) x) y))
(FPCore (x y) :precision binary64 (if (<= y 3.271832721285948e-299) (* y (* 3.0 (pow x 2.0))) (* 3.0 (pow (* x (sqrt y)) 2.0))))
double code(double x, double y) {
return ((x * 3.0) * x) * y;
}
double code(double x, double y) {
double tmp;
if (y <= 3.271832721285948e-299) {
tmp = y * (3.0 * pow(x, 2.0));
} else {
tmp = 3.0 * pow((x * sqrt(y)), 2.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * 3.0d0) * x) * y
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.271832721285948d-299) then
tmp = y * (3.0d0 * (x ** 2.0d0))
else
tmp = 3.0d0 * ((x * sqrt(y)) ** 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
return ((x * 3.0) * x) * y;
}
public static double code(double x, double y) {
double tmp;
if (y <= 3.271832721285948e-299) {
tmp = y * (3.0 * Math.pow(x, 2.0));
} else {
tmp = 3.0 * Math.pow((x * Math.sqrt(y)), 2.0);
}
return tmp;
}
def code(x, y): return ((x * 3.0) * x) * y
def code(x, y): tmp = 0 if y <= 3.271832721285948e-299: tmp = y * (3.0 * math.pow(x, 2.0)) else: tmp = 3.0 * math.pow((x * math.sqrt(y)), 2.0) return tmp
function code(x, y) return Float64(Float64(Float64(x * 3.0) * x) * y) end
function code(x, y) tmp = 0.0 if (y <= 3.271832721285948e-299) tmp = Float64(y * Float64(3.0 * (x ^ 2.0))); else tmp = Float64(3.0 * (Float64(x * sqrt(y)) ^ 2.0)); end return tmp end
function tmp = code(x, y) tmp = ((x * 3.0) * x) * y; end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.271832721285948e-299) tmp = y * (3.0 * (x ^ 2.0)); else tmp = 3.0 * ((x * sqrt(y)) ^ 2.0); end tmp_2 = tmp; end
code[x_, y_] := N[(N[(N[(x * 3.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]
code[x_, y_] := If[LessEqual[y, 3.271832721285948e-299], N[(y * N[(3.0 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[Power[N[(x * N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\begin{array}{l}
\mathbf{if}\;y \leq 3.271832721285948 \cdot 10^{-299}:\\
\;\;\;\;y \cdot \left(3 \cdot {x}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot {\left(x \cdot \sqrt{y}\right)}^{2}\\
\end{array}




Bits error versus x




Bits error versus y
Results
| Original | 11.0 |
|---|---|
| Target | 0.3 |
| Herbie | 5.9 |
if y < 3.27183272128594789e-299Initial program 11.2
Taylor expanded in x around 0 11.2
if 3.27183272128594789e-299 < y Initial program 10.9
Taylor expanded in x around 0 10.9
Applied egg-rr0.5
Final simplification5.9
herbie shell --seed 2022145
(FPCore (x y)
:name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(* (* x 3.0) (* x y))
(* (* (* x 3.0) x) y))