| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6528 |
\[{d1}^{4}
\]

(FPCore (d1) :precision binary64 (* (* (* d1 d1) d1) d1))
(FPCore (d1) :precision binary64 (pow d1 4.0))
double code(double d1) {
return ((d1 * d1) * d1) * d1;
}
double code(double d1) {
return pow(d1, 4.0);
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = ((d1 * d1) * d1) * d1
end function
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 ** 4.0d0
end function
public static double code(double d1) {
return ((d1 * d1) * d1) * d1;
}
public static double code(double d1) {
return Math.pow(d1, 4.0);
}
def code(d1): return ((d1 * d1) * d1) * d1
def code(d1): return math.pow(d1, 4.0)
function code(d1) return Float64(Float64(Float64(d1 * d1) * d1) * d1) end
function code(d1) return d1 ^ 4.0 end
function tmp = code(d1) tmp = ((d1 * d1) * d1) * d1; end
function tmp = code(d1) tmp = d1 ^ 4.0; end
code[d1_] := N[(N[(N[(d1 * d1), $MachinePrecision] * d1), $MachinePrecision] * d1), $MachinePrecision]
code[d1_] := N[Power[d1, 4.0], $MachinePrecision]
\left(\left(d1 \cdot d1\right) \cdot d1\right) \cdot d1
{d1}^{4}
Herbie found 3 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Results
| Original | 99.9% |
|---|---|
| Target | 100.0% |
| Herbie | 100.0% |
Initial program 99.9%
Simplified100.0%
[Start]99.9% | \[ \left(\left(d1 \cdot d1\right) \cdot d1\right) \cdot d1
\] |
|---|---|
unpow3 [<=]99.9% | \[ \color{blue}{{d1}^{3}} \cdot d1
\] |
pow-plus [=>]100.0% | \[ \color{blue}{{d1}^{\left(3 + 1\right)}}
\] |
metadata-eval [=>]100.0% | \[ {d1}^{\color{blue}{4}}
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6528 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 448 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 448 |
herbie shell --seed 2023178
(FPCore (d1)
:name "FastMath repmul"
:precision binary64
:herbie-target
(pow d1 4.0)
(* (* (* d1 d1) d1) d1))