(FPCore (x y) :precision binary64 (* (* (* x 3.0) x) y))
(FPCore (x y) :precision binary64 (if (<= y 1.22793750833344e-308) (* y (* x (* x 3.0))) (pow (* x (sqrt (* y 3.0))) 2.0)))
double code(double x, double y) {
return ((x * 3.0) * x) * y;
}
double code(double x, double y) {
double tmp;
if (y <= 1.22793750833344e-308) {
tmp = y * (x * (x * 3.0));
} else {
tmp = pow((x * sqrt((y * 3.0))), 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 <= 1.22793750833344d-308) then
tmp = y * (x * (x * 3.0d0))
else
tmp = (x * sqrt((y * 3.0d0))) ** 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 <= 1.22793750833344e-308) {
tmp = y * (x * (x * 3.0));
} else {
tmp = Math.pow((x * Math.sqrt((y * 3.0))), 2.0);
}
return tmp;
}
def code(x, y): return ((x * 3.0) * x) * y
def code(x, y): tmp = 0 if y <= 1.22793750833344e-308: tmp = y * (x * (x * 3.0)) else: tmp = math.pow((x * math.sqrt((y * 3.0))), 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 <= 1.22793750833344e-308) tmp = Float64(y * Float64(x * Float64(x * 3.0))); else tmp = Float64(x * sqrt(Float64(y * 3.0))) ^ 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 <= 1.22793750833344e-308) tmp = y * (x * (x * 3.0)); else tmp = (x * sqrt((y * 3.0))) ^ 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, 1.22793750833344e-308], N[(y * N[(x * N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(x * N[Sqrt[N[(y * 3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\begin{array}{l}
\mathbf{if}\;y \leq 1.22793750833344 \cdot 10^{-308}:\\
\;\;\;\;y \cdot \left(x \cdot \left(x \cdot 3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(x \cdot \sqrt{y \cdot 3}\right)}^{2}\\
\end{array}




Bits error versus x




Bits error versus y
Results
| Original | 10.6 |
|---|---|
| Target | 0.2 |
| Herbie | 5.2 |
if y < 1.22793750833344e-308Initial program 10.1
if 1.22793750833344e-308 < y Initial program 11.0
Taylor expanded in x around 0 11.0
Applied egg-rr0.5
Final simplification5.2
herbie shell --seed 2022134
(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))