
(FPCore (d1) :precision binary64 (* (* (* d1 d1) d1) d1))
double code(double d1) {
return ((d1 * d1) * d1) * d1;
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = ((d1 * d1) * d1) * d1
end function
public static double code(double d1) {
return ((d1 * d1) * d1) * d1;
}
def code(d1): return ((d1 * d1) * d1) * d1
function code(d1) return Float64(Float64(Float64(d1 * d1) * d1) * d1) end
function tmp = code(d1) tmp = ((d1 * d1) * d1) * d1; end
code[d1_] := N[(N[(N[(d1 * d1), $MachinePrecision] * d1), $MachinePrecision] * d1), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d1\right) \cdot d1\right) \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1) :precision binary64 (* (* (* d1 d1) d1) d1))
double code(double d1) {
return ((d1 * d1) * d1) * d1;
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = ((d1 * d1) * d1) * d1
end function
public static double code(double d1) {
return ((d1 * d1) * d1) * d1;
}
def code(d1): return ((d1 * d1) * d1) * d1
function code(d1) return Float64(Float64(Float64(d1 * d1) * d1) * d1) end
function tmp = code(d1) tmp = ((d1 * d1) * d1) * d1; end
code[d1_] := N[(N[(N[(d1 * d1), $MachinePrecision] * d1), $MachinePrecision] * d1), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d1\right) \cdot d1\right) \cdot d1
\end{array}
(FPCore (d1) :precision binary64 (pow d1 4.0))
double code(double d1) {
return pow(d1, 4.0);
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 ** 4.0d0
end function
public static double code(double d1) {
return Math.pow(d1, 4.0);
}
def code(d1): return math.pow(d1, 4.0)
function code(d1) return d1 ^ 4.0 end
function tmp = code(d1) tmp = d1 ^ 4.0; end
code[d1_] := N[Power[d1, 4.0], $MachinePrecision]
\begin{array}{l}
\\
{d1}^{4}
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
pow2N/A
pow2N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-eval100.0
Applied rewrites100.0%
(FPCore (d1) :precision binary64 (* (* (* d1 d1) d1) d1))
double code(double d1) {
return ((d1 * d1) * d1) * d1;
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = ((d1 * d1) * d1) * d1
end function
public static double code(double d1) {
return ((d1 * d1) * d1) * d1;
}
def code(d1): return ((d1 * d1) * d1) * d1
function code(d1) return Float64(Float64(Float64(d1 * d1) * d1) * d1) end
function tmp = code(d1) tmp = ((d1 * d1) * d1) * d1; end
code[d1_] := N[(N[(N[(d1 * d1), $MachinePrecision] * d1), $MachinePrecision] * d1), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d1\right) \cdot d1\right) \cdot d1
\end{array}
Initial program 99.9%
(FPCore (d1) :precision binary64 (* (* d1 d1) (* d1 d1)))
double code(double d1) {
return (d1 * d1) * (d1 * d1);
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = (d1 * d1) * (d1 * d1)
end function
public static double code(double d1) {
return (d1 * d1) * (d1 * d1);
}
def code(d1): return (d1 * d1) * (d1 * d1)
function code(d1) return Float64(Float64(d1 * d1) * Float64(d1 * d1)) end
function tmp = code(d1) tmp = (d1 * d1) * (d1 * d1); end
code[d1_] := N[(N[(d1 * d1), $MachinePrecision] * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(d1 \cdot d1\right) \cdot \left(d1 \cdot d1\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
(FPCore (d1) :precision binary64 (* (* d1 d1) d1))
double code(double d1) {
return (d1 * d1) * d1;
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = (d1 * d1) * d1
end function
public static double code(double d1) {
return (d1 * d1) * d1;
}
def code(d1): return (d1 * d1) * d1
function code(d1) return Float64(Float64(d1 * d1) * d1) end
function tmp = code(d1) tmp = (d1 * d1) * d1; end
code[d1_] := N[(N[(d1 * d1), $MachinePrecision] * d1), $MachinePrecision]
\begin{array}{l}
\\
\left(d1 \cdot d1\right) \cdot d1
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
pow2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites53.7%
(FPCore (d1) :precision binary64 (* d1 d1))
double code(double d1) {
return d1 * d1;
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 * d1
end function
public static double code(double d1) {
return d1 * d1;
}
def code(d1): return d1 * d1
function code(d1) return Float64(d1 * d1) end
function tmp = code(d1) tmp = d1 * d1; end
code[d1_] := N[(d1 * d1), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d1
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
pow2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites53.7%
Applied rewrites55.8%
(FPCore (d1) :precision binary64 d1)
double code(double d1) {
return d1;
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1
end function
public static double code(double d1) {
return d1;
}
def code(d1): return d1
function code(d1) return d1 end
function tmp = code(d1) tmp = d1; end
code[d1_] := d1
\begin{array}{l}
\\
d1
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
unpow-prod-downN/A
pow-to-expN/A
pow-to-expN/A
prod-expN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
+-inversesN/A
+-inversesN/A
associate-*l/N/A
Applied rewrites4.4%
(FPCore (d1) :precision binary64 (pow d1 4.0))
double code(double d1) {
return pow(d1, 4.0);
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 ** 4.0d0
end function
public static double code(double d1) {
return Math.pow(d1, 4.0);
}
def code(d1): return math.pow(d1, 4.0)
function code(d1) return d1 ^ 4.0 end
function tmp = code(d1) tmp = d1 ^ 4.0; end
code[d1_] := N[Power[d1, 4.0], $MachinePrecision]
\begin{array}{l}
\\
{d1}^{4}
\end{array}
herbie shell --seed 2024288
(FPCore (d1)
:name "FastMath repmul"
:precision binary64
:alt
(! :herbie-platform default (pow d1 4))
(* (* (* d1 d1) d1) d1))