
(FPCore (x y) :precision binary64 (* (* x 27.0) y))
double code(double x, double y) {
return (x * 27.0) * y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * 27.0d0) * y
end function
public static double code(double x, double y) {
return (x * 27.0) * y;
}
def code(x, y): return (x * 27.0) * y
function code(x, y) return Float64(Float64(x * 27.0) * y) end
function tmp = code(x, y) tmp = (x * 27.0) * y; end
code[x_, y_] := N[(N[(x * 27.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 27\right) \cdot y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 3 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (* x 27.0) y))
double code(double x, double y) {
return (x * 27.0) * y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * 27.0d0) * y
end function
public static double code(double x, double y) {
return (x * 27.0) * y;
}
def code(x, y): return (x * 27.0) * y
function code(x, y) return Float64(Float64(x * 27.0) * y) end
function tmp = code(x, y) tmp = (x * 27.0) * y; end
code[x_, y_] := N[(N[(x * 27.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 27\right) \cdot y
\end{array}
(FPCore (x y) :precision binary64 (* (* y x) 27.0))
double code(double x, double y) {
return (y * x) * 27.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * x) * 27.0d0
end function
public static double code(double x, double y) {
return (y * x) * 27.0;
}
def code(x, y): return (y * x) * 27.0
function code(x, y) return Float64(Float64(y * x) * 27.0) end
function tmp = code(x, y) tmp = (y * x) * 27.0; end
code[x_, y_] := N[(N[(y * x), $MachinePrecision] * 27.0), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot x\right) \cdot 27
\end{array}
Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
(FPCore (x y) :precision binary64 (* (* y 27.0) x))
double code(double x, double y) {
return (y * 27.0) * x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * 27.0d0) * x
end function
public static double code(double x, double y) {
return (y * 27.0) * x;
}
def code(x, y): return (y * 27.0) * x
function code(x, y) return Float64(Float64(y * 27.0) * x) end
function tmp = code(x, y) tmp = (y * 27.0) * x; end
code[x_, y_] := N[(N[(y * 27.0), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot 27\right) \cdot x
\end{array}
Initial program 99.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
(FPCore (x y) :precision binary64 (* (* x 27.0) y))
double code(double x, double y) {
return (x * 27.0) * y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * 27.0d0) * y
end function
public static double code(double x, double y) {
return (x * 27.0) * y;
}
def code(x, y): return (x * 27.0) * y
function code(x, y) return Float64(Float64(x * 27.0) * y) end
function tmp = code(x, y) tmp = (x * 27.0) * y; end
code[x_, y_] := N[(N[(x * 27.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 27\right) \cdot y
\end{array}
Initial program 99.7%
herbie shell --seed 2024307
(FPCore (x y)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, F"
:precision binary64
(* (* x 27.0) y))