
(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 9 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
lower-pow.f64100.0
Applied rewrites100.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 rewrites89.3%
Final simplification89.3%
(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 rewrites68.1%
Final simplification68.1%
(FPCore (d1) :precision binary64 (let* ((t_0 (* d1 (* d1 d1)))) (* t_0 t_0)))
double code(double d1) {
double t_0 = d1 * (d1 * d1);
return t_0 * t_0;
}
real(8) function code(d1)
real(8), intent (in) :: d1
real(8) :: t_0
t_0 = d1 * (d1 * d1)
code = t_0 * t_0
end function
public static double code(double d1) {
double t_0 = d1 * (d1 * d1);
return t_0 * t_0;
}
def code(d1): t_0 = d1 * (d1 * d1) return t_0 * t_0
function code(d1) t_0 = Float64(d1 * Float64(d1 * d1)) return Float64(t_0 * t_0) end
function tmp = code(d1) t_0 = d1 * (d1 * d1); tmp = t_0 * t_0; end
code[d1_] := Block[{t$95$0 = N[(d1 * N[(d1 * d1), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d1 \cdot d1\right)\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Initial program 99.9%
Applied rewrites89.3%
Applied rewrites84.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6484.5
Applied rewrites84.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 rewrites78.2%
Final simplification78.2%
(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 rewrites55.6%
Final simplification55.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 rewrites58.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 rewrites4.6%
(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 2024213
(FPCore (d1)
:name "FastMath test5"
:precision binary64
:alt
(! :herbie-platform default (pow d1 10))
(* (* d1 (* (* (* (* (* d1 (* d1 d1)) d1) d1) (* d1 d1)) d1)) d1))