(FPCore (t) :precision binary64 (round (- (- (* 114.414639980025 t) (* 0.0325406046935314 (pow (- (/ (* 5.0 t) 9.0) (/ 160.0 9.0)) 2.0))) 1963.30142331927)))
double code(double t) { return round((((114.414639980025 * t) - (0.0325406046935314 * pow((((5.0 * t) / 9.0) - (160.0 / 9.0)), 2.0))) - 1963.30142331927)); }
real(8) function code(t) real(8), intent (in) :: t code = anint((((114.414639980025d0 * t) - (0.0325406046935314d0 * ((((5.0d0 * t) / 9.0d0) - (160.0d0 / 9.0d0)) ** 2.0d0))) - 1963.30142331927d0)) end function
function code(t) return round(Float64(Float64(Float64(114.414639980025 * t) - Float64(0.0325406046935314 * (Float64(Float64(Float64(5.0 * t) / 9.0) - Float64(160.0 / 9.0)) ^ 2.0))) - 1963.30142331927)) end
function tmp = code(t) tmp = round((((114.414639980025 * t) - (0.0325406046935314 * ((((5.0 * t) / 9.0) - (160.0 / 9.0)) ^ 2.0))) - 1963.30142331927)); end
code[t_] := N[With[{TMP1 = N[(N[(N[(114.414639980025 * t), $MachinePrecision] - N[(0.0325406046935314 * N[Power[N[(N[(N[(5.0 * t), $MachinePrecision] / 9.0), $MachinePrecision] - N[(160.0 / 9.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1963.30142331927), $MachinePrecision]}, If[Abs[TMP1] - Floor[Abs[TMP1]] < 1/2, Floor[Abs[TMP1]] * Sign[TMP1], Ceiling[Abs[TMP1]] * Sign[TMP1]]], $MachinePrecision]
\begin{array}{l} \\ \mathsf{round} \left(\left(114.414639980025 \cdot t - 0.0325406046935314 \cdot {\left(\frac{5 \cdot t}{9} - \frac{160}{9}\right)}^{2}\right) - 1963.30142331927\right) \end{array}
Sampling outcomes in binary64 precision:
Herbie found 4 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (t) :precision binary64 (round (- (- (* 114.414639980025 t) (* 0.0325406046935314 (pow (- (/ (* 5.0 t) 9.0) (/ 160.0 9.0)) 2.0))) 1963.30142331927)))
double code(double t) { return round((((114.414639980025 * t) - (0.0325406046935314 * pow((((5.0 * t) / 9.0) - (160.0 / 9.0)), 2.0))) - 1963.30142331927)); }
real(8) function code(t) real(8), intent (in) :: t code = anint((((114.414639980025d0 * t) - (0.0325406046935314d0 * ((((5.0d0 * t) / 9.0d0) - (160.0d0 / 9.0d0)) ** 2.0d0))) - 1963.30142331927d0)) end function
function code(t) return round(Float64(Float64(Float64(114.414639980025 * t) - Float64(0.0325406046935314 * (Float64(Float64(Float64(5.0 * t) / 9.0) - Float64(160.0 / 9.0)) ^ 2.0))) - 1963.30142331927)) end
function tmp = code(t) tmp = round((((114.414639980025 * t) - (0.0325406046935314 * ((((5.0 * t) / 9.0) - (160.0 / 9.0)) ^ 2.0))) - 1963.30142331927)); end
code[t_] := N[With[{TMP1 = N[(N[(N[(114.414639980025 * t), $MachinePrecision] - N[(0.0325406046935314 * N[Power[N[(N[(N[(5.0 * t), $MachinePrecision] / 9.0), $MachinePrecision] - N[(160.0 / 9.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1963.30142331927), $MachinePrecision]}, If[Abs[TMP1] - Floor[Abs[TMP1]] < 1/2, Floor[Abs[TMP1]] * Sign[TMP1], Ceiling[Abs[TMP1]] * Sign[TMP1]]], $MachinePrecision]
\begin{array}{l} \\ \mathsf{round} \left(\left(114.414639980025 \cdot t - 0.0325406046935314 \cdot {\left(\frac{5 \cdot t}{9} - \frac{160}{9}\right)}^{2}\right) - 1963.30142331927\right) \end{array}
(FPCore (t) :precision binary64 (round (fma (fma -0.010043396510349198 t 115.05741735668735) t -1973.5858613458677)))
double code(double t) { return round(fma(fma(-0.010043396510349198, t, 115.05741735668735), t, -1973.5858613458677)); }
function code(t) return round(fma(fma(-0.010043396510349198, t, 115.05741735668735), t, -1973.5858613458677)) end
code[t_] := N[With[{TMP1 = N[(N[(-0.010043396510349198 * t + 115.05741735668735), $MachinePrecision] * t + -1973.5858613458677), $MachinePrecision]}, If[Abs[TMP1] - Floor[Abs[TMP1]] < 1/2, Floor[Abs[TMP1]] * Sign[TMP1], Ceiling[Abs[TMP1]] * Sign[TMP1]]], $MachinePrecision]
\begin{array}{l} \\ \mathsf{round} \left(\mathsf{fma}\left(\mathsf{fma}\left(-0.010043396510349198, t, 115.05741735668735\right), t, -1973.5858613458677\right)\right) \end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites100.0%
(FPCore (t) :precision binary64 (round (fma 115.05741735668735 t -1973.5858613458677)))
double code(double t) { return round(fma(115.05741735668735, t, -1973.5858613458677)); }
function code(t) return round(fma(115.05741735668735, t, -1973.5858613458677)) end
code[t_] := N[With[{TMP1 = N[(115.05741735668735 * t + -1973.5858613458677), $MachinePrecision]}, If[Abs[TMP1] - Floor[Abs[TMP1]] < 1/2, Floor[Abs[TMP1]] * Sign[TMP1], Ceiling[Abs[TMP1]] * Sign[TMP1]]], $MachinePrecision]
\begin{array}{l} \\ \mathsf{round} \left(\mathsf{fma}\left(115.05741735668735, t, -1973.5858613458677\right)\right) \end{array}
Initial program 100.0%
Taylor expanded in t around 0
sub-neg
N/A
metadata-eval
N/A
metadata-eval
N/A
lft-mult-inverse
N/A
associate-*l/
N/A
*-lft-identity
N/A
metadata-eval
N/A
times-frac
N/A
associate-*r/
N/A
*-commutative
N/A
mul-1-neg
N/A
distribute-neg-frac2
N/A
lower-fma.f64
N/A
distribute-neg-frac2
N/A
mul-1-neg
N/A
*-commutative
N/A
associate-*r/
N/A
times-frac
N/A
*-lft-identity
N/A
associate-*l/
N/A
lft-mult-inverse
N/A
metadata-eval
N/A
metadata-eval
28.2
Applied rewrites28.2%
(FPCore (t) :precision binary64 (round (* 115.05741735668735 t)))
double code(double t) { return round((115.05741735668735 * t)); }
real(8) function code(t) real(8), intent (in) :: t code = anint((115.05741735668735d0 * t)) end function
function code(t) return round(Float64(115.05741735668735 * t)) end
function tmp = code(t) tmp = round((115.05741735668735 * t)); end
code[t_] := N[With[{TMP1 = N[(115.05741735668735 * t), $MachinePrecision]}, If[Abs[TMP1] - Floor[Abs[TMP1]] < 1/2, Floor[Abs[TMP1]] * Sign[TMP1], Ceiling[Abs[TMP1]] * Sign[TMP1]]], $MachinePrecision]
\begin{array}{l} \\ \mathsf{round} \left(115.05741735668735 \cdot t\right) \end{array}
Initial program 100.0%
Taylor expanded in t around 0
sub-neg
N/A
metadata-eval
N/A
metadata-eval
N/A
lft-mult-inverse
N/A
associate-*l/
N/A
*-lft-identity
N/A
metadata-eval
N/A
times-frac
N/A
associate-*r/
N/A
*-commutative
N/A
mul-1-neg
N/A
distribute-neg-frac2
N/A
lower-fma.f64
N/A
distribute-neg-frac2
N/A
mul-1-neg
N/A
*-commutative
N/A
associate-*r/
N/A
times-frac
N/A
*-lft-identity
N/A
associate-*l/
N/A
lft-mult-inverse
N/A
metadata-eval
N/A
metadata-eval
28.2
Applied rewrites28.2%
Taylor expanded in t around inf
Applied rewrites21.1%
(FPCore (t) :precision binary64 (round -1973.5858613458677))
double code(double t) { return round(-1973.5858613458677); }
real(8) function code(t) real(8), intent (in) :: t code = anint((-1973.5858613458677d0)) end function
function code(t) return round(-1973.5858613458677) end
function tmp = code(t) tmp = round(-1973.5858613458677); end
code[t_] := N[With[{TMP1 = -1973.5858613458677}, If[Abs[TMP1] - Floor[Abs[TMP1]] < 1/2, Floor[Abs[TMP1]] * Sign[TMP1], Ceiling[Abs[TMP1]] * Sign[TMP1]]], $MachinePrecision]
\begin{array}{l} \\ \mathsf{round} -1973.5858613458677 \end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites1.5%
herbie shell --seed 1
(FPCore (t)
:name "round(114.414639980025*t - 0.0325406046935314*(5*t/9 - 160/9)^2 - 1963.30142331927)"
:precision binary64
:pre (and (<= 25.0 t) (<= t 300.0))
(round (- (- (* 114.414639980025 t) (* 0.0325406046935314 (pow (- (/ (* 5.0 t) 9.0) (/ 160.0 9.0)) 2.0))) 1963.30142331927)))