
(FPCore (d1) :precision binary64 (* (* d1 (* (* (* (* (* d1 (* d1 d1)) d1) d1) (* d1 d1)) d1)) d1))
double code(double d1) {
return (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1;
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1
end function
public static double code(double d1) {
return (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1;
}
def code(d1): return (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1
function code(d1) return Float64(Float64(d1 * Float64(Float64(Float64(Float64(Float64(d1 * Float64(d1 * d1)) * d1) * d1) * Float64(d1 * d1)) * d1)) * d1) end
function tmp = code(d1) tmp = (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1; end
code[d1_] := N[(N[(d1 * N[(N[(N[(N[(N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision] * d1), $MachinePrecision] * d1), $MachinePrecision] * N[(d1 * d1), $MachinePrecision]), $MachinePrecision] * d1), $MachinePrecision]), $MachinePrecision] * d1), $MachinePrecision]
\begin{array}{l}
\\
\left(d1 \cdot \left(\left(\left(\left(\left(d1 \cdot \left(d1 \cdot d1\right)\right) \cdot d1\right) \cdot d1\right) \cdot \left(d1 \cdot d1\right)\right) \cdot d1\right)\right) \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1) :precision binary64 (* (* d1 (* (* (* (* (* d1 (* d1 d1)) d1) d1) (* d1 d1)) d1)) d1))
double code(double d1) {
return (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1;
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1
end function
public static double code(double d1) {
return (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1;
}
def code(d1): return (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1
function code(d1) return Float64(Float64(d1 * Float64(Float64(Float64(Float64(Float64(d1 * Float64(d1 * d1)) * d1) * d1) * Float64(d1 * d1)) * d1)) * d1) end
function tmp = code(d1) tmp = (d1 * (((((d1 * (d1 * d1)) * d1) * d1) * (d1 * d1)) * d1)) * d1; end
code[d1_] := N[(N[(d1 * N[(N[(N[(N[(N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision] * d1), $MachinePrecision] * d1), $MachinePrecision] * N[(d1 * d1), $MachinePrecision]), $MachinePrecision] * d1), $MachinePrecision]), $MachinePrecision] * d1), $MachinePrecision]
\begin{array}{l}
\\
\left(d1 \cdot \left(\left(\left(\left(\left(d1 \cdot \left(d1 \cdot d1\right)\right) \cdot d1\right) \cdot d1\right) \cdot \left(d1 \cdot d1\right)\right) \cdot d1\right)\right) \cdot d1
\end{array}
(FPCore (d1) :precision binary64 (pow d1 10.0))
double code(double d1) {
return pow(d1, 10.0);
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 ** 10.0d0
end function
public static double code(double d1) {
return Math.pow(d1, 10.0);
}
def code(d1): return math.pow(d1, 10.0)
function code(d1) return d1 ^ 10.0 end
function tmp = code(d1) tmp = d1 ^ 10.0; end
code[d1_] := N[Power[d1, 10.0], $MachinePrecision]
\begin{array}{l}
\\
{d1}^{10}
\end{array}
Initial program 99.9%
Taylor expanded in d1 around 0
pow-lowering-pow.f64100.0
Simplified100.0%
(FPCore (d1) :precision binary64 (* d1 (* d1 (* d1 (* (* d1 d1) (* d1 (* d1 (* d1 (* d1 d1)))))))))
double code(double d1) {
return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * (d1 * (d1 * d1)))))));
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * (d1 * (d1 * d1)))))))
end function
public static double code(double d1) {
return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * (d1 * (d1 * d1)))))));
}
def code(d1): return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * (d1 * (d1 * d1)))))))
function code(d1) return Float64(d1 * Float64(d1 * Float64(d1 * Float64(Float64(d1 * d1) * Float64(d1 * Float64(d1 * Float64(d1 * Float64(d1 * d1)))))))) end
function tmp = code(d1) tmp = d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * (d1 * (d1 * d1))))))); end
code[d1_] := N[(d1 * N[(d1 * N[(d1 * N[(N[(d1 * d1), $MachinePrecision] * N[(d1 * N[(d1 * N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d1 \cdot \left(d1 \cdot \left(\left(d1 \cdot d1\right) \cdot \left(d1 \cdot \left(d1 \cdot \left(d1 \cdot \left(d1 \cdot d1\right)\right)\right)\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (d1) :precision binary64 (* d1 (* d1 (* d1 (* (* d1 d1) (* d1 (* d1 d1)))))))
double code(double d1) {
return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * d1)))));
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * d1)))))
end function
public static double code(double d1) {
return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * d1)))));
}
def code(d1): return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * d1)))))
function code(d1) return Float64(d1 * Float64(d1 * Float64(d1 * Float64(Float64(d1 * d1) * Float64(d1 * Float64(d1 * d1)))))) end
function tmp = code(d1) tmp = d1 * (d1 * (d1 * ((d1 * d1) * (d1 * (d1 * d1))))); end
code[d1_] := N[(d1 * N[(d1 * N[(d1 * N[(N[(d1 * d1), $MachinePrecision] * N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d1 \cdot \left(d1 \cdot \left(\left(d1 \cdot d1\right) \cdot \left(d1 \cdot \left(d1 \cdot d1\right)\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Applied egg-rr85.9%
Final simplification85.9%
(FPCore (d1) :precision binary64 (* d1 (* d1 (* d1 (* (* d1 d1) (* d1 d1))))))
double code(double d1) {
return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * d1))));
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 * (d1 * (d1 * ((d1 * d1) * (d1 * d1))))
end function
public static double code(double d1) {
return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * d1))));
}
def code(d1): return d1 * (d1 * (d1 * ((d1 * d1) * (d1 * d1))))
function code(d1) return Float64(d1 * Float64(d1 * Float64(d1 * Float64(Float64(d1 * d1) * Float64(d1 * d1))))) end
function tmp = code(d1) tmp = d1 * (d1 * (d1 * ((d1 * d1) * (d1 * d1)))); end
code[d1_] := N[(d1 * N[(d1 * N[(d1 * N[(N[(d1 * d1), $MachinePrecision] * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d1 \cdot \left(d1 \cdot \left(\left(d1 \cdot d1\right) \cdot \left(d1 \cdot d1\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Applied egg-rr63.0%
Final simplification63.0%
(FPCore (d1) :precision binary64 (* d1 (* d1 (* d1 (* d1 (* d1 d1))))))
double code(double d1) {
return d1 * (d1 * (d1 * (d1 * (d1 * d1))));
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 * (d1 * (d1 * (d1 * (d1 * d1))))
end function
public static double code(double d1) {
return d1 * (d1 * (d1 * (d1 * (d1 * d1))));
}
def code(d1): return d1 * (d1 * (d1 * (d1 * (d1 * d1))))
function code(d1) return Float64(d1 * Float64(d1 * Float64(d1 * Float64(d1 * Float64(d1 * d1))))) end
function tmp = code(d1) tmp = d1 * (d1 * (d1 * (d1 * (d1 * d1)))); end
code[d1_] := N[(d1 * N[(d1 * N[(d1 * N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d1 \cdot \left(d1 \cdot \left(d1 \cdot \left(d1 \cdot d1\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Applied egg-rr80.5%
Final simplification80.5%
(FPCore (d1) :precision binary64 (* d1 (* d1 (* d1 (* d1 d1)))))
double code(double d1) {
return d1 * (d1 * (d1 * (d1 * d1)));
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 * (d1 * (d1 * (d1 * d1)))
end function
public static double code(double d1) {
return d1 * (d1 * (d1 * (d1 * d1)));
}
def code(d1): return d1 * (d1 * (d1 * (d1 * d1)))
function code(d1) return Float64(d1 * Float64(d1 * Float64(d1 * Float64(d1 * d1)))) end
function tmp = code(d1) tmp = d1 * (d1 * (d1 * (d1 * d1))); end
code[d1_] := N[(d1 * N[(d1 * N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d1 \cdot \left(d1 \cdot \left(d1 \cdot d1\right)\right)\right)
\end{array}
Initial program 99.9%
Applied egg-rr80.5%
Applied egg-rr56.5%
Final simplification56.5%
(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(d1 * Float64(d1 * Float64(d1 * d1))) end
function tmp = code(d1) tmp = d1 * (d1 * (d1 * d1)); end
code[d1_] := N[(d1 * N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d1 \cdot \left(d1 \cdot d1\right)\right)
\end{array}
Initial program 99.9%
Applied egg-rr73.7%
Final simplification73.7%
(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(d1 * Float64(d1 * d1)) end
function tmp = code(d1) tmp = d1 * (d1 * d1); end
code[d1_] := N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d1 \cdot d1\right)
\end{array}
Initial program 99.9%
Applied egg-rr47.6%
Final simplification47.6%
(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%
Applied egg-rr46.5%
(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%
Applied egg-rr4.0%
(FPCore (d1) :precision binary64 (pow d1 10.0))
double code(double d1) {
return pow(d1, 10.0);
}
real(8) function code(d1)
real(8), intent (in) :: d1
code = d1 ** 10.0d0
end function
public static double code(double d1) {
return Math.pow(d1, 10.0);
}
def code(d1): return math.pow(d1, 10.0)
function code(d1) return d1 ^ 10.0 end
function tmp = code(d1) tmp = d1 ^ 10.0; end
code[d1_] := N[Power[d1, 10.0], $MachinePrecision]
\begin{array}{l}
\\
{d1}^{10}
\end{array}
herbie shell --seed 2024196
(FPCore (d1)
:name "FastMath test5"
:precision binary64
:alt
(! :herbie-platform default (pow d1 10))
(* (* d1 (* (* (* (* (* d1 (* d1 d1)) d1) d1) (* d1 d1)) d1)) d1))