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