(FPCore (t d_1 d_2) :precision binary64 (* (sqrt (pow 1.0001 t)) (pow 10.0 (- d_1 d_2))))
double code(double t, double d_1, double d_2) { return sqrt(pow(1.0001, t)) * pow(10.0, (d_1 - d_2)); }
real(8) function code(t, d_1, d_2) real(8), intent (in) :: t real(8), intent (in) :: d_1 real(8), intent (in) :: d_2 code = sqrt((1.0001d0 ** t)) * (10.0d0 ** (d_1 - d_2)) end function
public static double code(double t, double d_1, double d_2) { return Math.sqrt(Math.pow(1.0001, t)) * Math.pow(10.0, (d_1 - d_2)); }
def code(t, d_1, d_2): return math.sqrt(math.pow(1.0001, t)) * math.pow(10.0, (d_1 - d_2))
function code(t, d_1, d_2) return Float64(sqrt((1.0001 ^ t)) * (10.0 ^ Float64(d_1 - d_2))) end
function tmp = code(t, d_1, d_2) tmp = sqrt((1.0001 ^ t)) * (10.0 ^ (d_1 - d_2)); end
code[t_, d$95$1_, d$95$2_] := N[(N[Sqrt[N[Power[1.0001, t], $MachinePrecision]], $MachinePrecision] * N[Power[10.0, N[(d$95$1 - d$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \end{array}
Sampling outcomes in binary64 precision:
Herbie found 5 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (t d_1 d_2) :precision binary64 (* (sqrt (pow 1.0001 t)) (pow 10.0 (- d_1 d_2))))
double code(double t, double d_1, double d_2) { return sqrt(pow(1.0001, t)) * pow(10.0, (d_1 - d_2)); }
real(8) function code(t, d_1, d_2) real(8), intent (in) :: t real(8), intent (in) :: d_1 real(8), intent (in) :: d_2 code = sqrt((1.0001d0 ** t)) * (10.0d0 ** (d_1 - d_2)) end function
public static double code(double t, double d_1, double d_2) { return Math.sqrt(Math.pow(1.0001, t)) * Math.pow(10.0, (d_1 - d_2)); }
def code(t, d_1, d_2): return math.sqrt(math.pow(1.0001, t)) * math.pow(10.0, (d_1 - d_2))
function code(t, d_1, d_2) return Float64(sqrt((1.0001 ^ t)) * (10.0 ^ Float64(d_1 - d_2))) end
function tmp = code(t, d_1, d_2) tmp = sqrt((1.0001 ^ t)) * (10.0 ^ (d_1 - d_2)); end
code[t_, d$95$1_, d$95$2_] := N[(N[Sqrt[N[Power[1.0001, t], $MachinePrecision]], $MachinePrecision] * N[Power[10.0, N[(d$95$1 - d$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \end{array}
(FPCore (t d_1 d_2) :precision binary64 (* (pow 1.0001 (* 0.5 t)) (pow 10.0 (- d_1 d_2))))
double code(double t, double d_1, double d_2) { return pow(1.0001, (0.5 * t)) * pow(10.0, (d_1 - d_2)); }
real(8) function code(t, d_1, d_2) real(8), intent (in) :: t real(8), intent (in) :: d_1 real(8), intent (in) :: d_2 code = (1.0001d0 ** (0.5d0 * t)) * (10.0d0 ** (d_1 - d_2)) end function
public static double code(double t, double d_1, double d_2) { return Math.pow(1.0001, (0.5 * t)) * Math.pow(10.0, (d_1 - d_2)); }
def code(t, d_1, d_2): return math.pow(1.0001, (0.5 * t)) * math.pow(10.0, (d_1 - d_2))
function code(t, d_1, d_2) return Float64((1.0001 ^ Float64(0.5 * t)) * (10.0 ^ Float64(d_1 - d_2))) end
function tmp = code(t, d_1, d_2) tmp = (1.0001 ^ (0.5 * t)) * (10.0 ^ (d_1 - d_2)); end
code[t_, d$95$1_, d$95$2_] := N[(N[Power[1.0001, N[(0.5 * t), $MachinePrecision]], $MachinePrecision] * N[Power[10.0, N[(d$95$1 - d$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ {1.0001}^{\left(0.5 \cdot t\right)} \cdot {10}^{\left(d\_1 - d\_2\right)} \end{array}
Initial program 100.0%
lift-sqrt.f64
N/A
lift-pow.f64
N/A
sqrt-pow1
N/A
lower-pow.f64
N/A
div-inv
N/A
metadata-eval
N/A
*-commutative
N/A
lower-*.f64
100.0
Applied rewrites100.0%
(FPCore (t d_1 d_2) :precision binary64 (if (<= (* (sqrt (pow 1.0001 t)) (pow 10.0 (- d_1 d_2))) 0.9999999999999999) (pow 0.1 d_2) (pow 10.0 d_1)))
double code(double t, double d_1, double d_2) { double tmp; if ((sqrt(pow(1.0001, t)) * pow(10.0, (d_1 - d_2))) <= 0.9999999999999999) { tmp = pow(0.1, d_2); } else { tmp = pow(10.0, d_1); } return tmp; }
real(8) function code(t, d_1, d_2) real(8), intent (in) :: t real(8), intent (in) :: d_1 real(8), intent (in) :: d_2 real(8) :: tmp if ((sqrt((1.0001d0 ** t)) * (10.0d0 ** (d_1 - d_2))) <= 0.9999999999999999d0) then tmp = 0.1d0 ** d_2 else tmp = 10.0d0 ** d_1 end if code = tmp end function
public static double code(double t, double d_1, double d_2) { double tmp; if ((Math.sqrt(Math.pow(1.0001, t)) * Math.pow(10.0, (d_1 - d_2))) <= 0.9999999999999999) { tmp = Math.pow(0.1, d_2); } else { tmp = Math.pow(10.0, d_1); } return tmp; }
def code(t, d_1, d_2): tmp = 0 if (math.sqrt(math.pow(1.0001, t)) * math.pow(10.0, (d_1 - d_2))) <= 0.9999999999999999: tmp = math.pow(0.1, d_2) else: tmp = math.pow(10.0, d_1) return tmp
function code(t, d_1, d_2) tmp = 0.0 if (Float64(sqrt((1.0001 ^ t)) * (10.0 ^ Float64(d_1 - d_2))) <= 0.9999999999999999) tmp = 0.1 ^ d_2; else tmp = 10.0 ^ d_1; end return tmp end
function tmp_2 = code(t, d_1, d_2) tmp = 0.0; if ((sqrt((1.0001 ^ t)) * (10.0 ^ (d_1 - d_2))) <= 0.9999999999999999) tmp = 0.1 ^ d_2; else tmp = 10.0 ^ d_1; end tmp_2 = tmp; end
code[t_, d$95$1_, d$95$2_] := If[LessEqual[N[(N[Sqrt[N[Power[1.0001, t], $MachinePrecision]], $MachinePrecision] * N[Power[10.0, N[(d$95$1 - d$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.9999999999999999], N[Power[0.1, d$95$2], $MachinePrecision], N[Power[10.0, d$95$1], $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \leq 0.9999999999999999:\\ \;\;\;\;{0.1}^{d\_2}\\ \mathbf{else}:\\ \;\;\;\;{10}^{d\_1}\\ \end{array} \end{array}
if (*.f64 (sqrt.f64 (pow.f64 #s(literal 4504049987333233/4503599627370496 binary64) t)) (pow.f64 #s(literal 10 binary64) (-.f64 d_1 d_2))) < 0.999999999999999889
Initial program 99.8%
Taylor expanded in t around 0
exp-to-pow
N/A
sub-neg
N/A
mul-1-neg
N/A
+-commutative
N/A
mul-1-neg
N/A
remove-double-neg
N/A
mul-1-neg
N/A
distribute-neg-in
N/A
exp-to-pow
N/A
distribute-rgt-neg-in
N/A
mul-1-neg
N/A
associate-*r*
N/A
exp-prod
N/A
lower-pow.f64
N/A
*-commutative
N/A
exp-to-pow
N/A
metadata-eval
N/A
mul-1-neg
N/A
unsub-neg
N/A
lower--.f64
81.1
Applied rewrites81.1%
Taylor expanded in d_1 around 0
Applied rewrites81.1%
if 0.999999999999999889 < (*.f64 (sqrt.f64 (pow.f64 #s(literal 4504049987333233/4503599627370496 binary64) t)) (pow.f64 #s(literal 10 binary64) (-.f64 d_1 d_2)))
Initial program 100.0%
Taylor expanded in t around 0
exp-to-pow
N/A
sub-neg
N/A
mul-1-neg
N/A
+-commutative
N/A
mul-1-neg
N/A
remove-double-neg
N/A
mul-1-neg
N/A
distribute-neg-in
N/A
exp-to-pow
N/A
distribute-rgt-neg-in
N/A
mul-1-neg
N/A
associate-*r*
N/A
exp-prod
N/A
lower-pow.f64
N/A
*-commutative
N/A
exp-to-pow
N/A
metadata-eval
N/A
mul-1-neg
N/A
unsub-neg
N/A
lower--.f64
98.2
Applied rewrites98.2%
Taylor expanded in d_2 around 0
Applied rewrites98.2%
(FPCore (t d_1 d_2) :precision binary64 (if (<= (- d_1 d_2) -2e-17) (pow 0.1 d_2) (* (pow 1.0001 (* 0.5 t)) (pow 10.0 d_1))))
double code(double t, double d_1, double d_2) { double tmp; if ((d_1 - d_2) <= -2e-17) { tmp = pow(0.1, d_2); } else { tmp = pow(1.0001, (0.5 * t)) * pow(10.0, d_1); } return tmp; }
real(8) function code(t, d_1, d_2) real(8), intent (in) :: t real(8), intent (in) :: d_1 real(8), intent (in) :: d_2 real(8) :: tmp if ((d_1 - d_2) <= (-2d-17)) then tmp = 0.1d0 ** d_2 else tmp = (1.0001d0 ** (0.5d0 * t)) * (10.0d0 ** d_1) end if code = tmp end function
public static double code(double t, double d_1, double d_2) { double tmp; if ((d_1 - d_2) <= -2e-17) { tmp = Math.pow(0.1, d_2); } else { tmp = Math.pow(1.0001, (0.5 * t)) * Math.pow(10.0, d_1); } return tmp; }
def code(t, d_1, d_2): tmp = 0 if (d_1 - d_2) <= -2e-17: tmp = math.pow(0.1, d_2) else: tmp = math.pow(1.0001, (0.5 * t)) * math.pow(10.0, d_1) return tmp
function code(t, d_1, d_2) tmp = 0.0 if (Float64(d_1 - d_2) <= -2e-17) tmp = 0.1 ^ d_2; else tmp = Float64((1.0001 ^ Float64(0.5 * t)) * (10.0 ^ d_1)); end return tmp end
function tmp_2 = code(t, d_1, d_2) tmp = 0.0; if ((d_1 - d_2) <= -2e-17) tmp = 0.1 ^ d_2; else tmp = (1.0001 ^ (0.5 * t)) * (10.0 ^ d_1); end tmp_2 = tmp; end
code[t_, d$95$1_, d$95$2_] := If[LessEqual[N[(d$95$1 - d$95$2), $MachinePrecision], -2e-17], N[Power[0.1, d$95$2], $MachinePrecision], N[(N[Power[1.0001, N[(0.5 * t), $MachinePrecision]], $MachinePrecision] * N[Power[10.0, d$95$1], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d\_1 - d\_2 \leq -2 \cdot 10^{-17}:\\ \;\;\;\;{0.1}^{d\_2}\\ \mathbf{else}:\\ \;\;\;\;{1.0001}^{\left(0.5 \cdot t\right)} \cdot {10}^{d\_1}\\ \end{array} \end{array}
if (-.f64 d_1 d_2) < -2.00000000000000014e-17
Initial program 100.0%
Taylor expanded in t around 0
exp-to-pow
N/A
sub-neg
N/A
mul-1-neg
N/A
+-commutative
N/A
mul-1-neg
N/A
remove-double-neg
N/A
mul-1-neg
N/A
distribute-neg-in
N/A
exp-to-pow
N/A
distribute-rgt-neg-in
N/A
mul-1-neg
N/A
associate-*r*
N/A
exp-prod
N/A
lower-pow.f64
N/A
*-commutative
N/A
exp-to-pow
N/A
metadata-eval
N/A
mul-1-neg
N/A
unsub-neg
N/A
lower--.f64
100.0
Applied rewrites100.0%
Taylor expanded in d_1 around 0
Applied rewrites100.0%
if -2.00000000000000014e-17 < (-.f64 d_1 d_2)
Initial program 100.0%
lift-sqrt.f64
N/A
lift-pow.f64
N/A
sqrt-pow1
N/A
lower-pow.f64
N/A
div-inv
N/A
metadata-eval
N/A
*-commutative
N/A
lower-*.f64
100.0
Applied rewrites100.0%
Taylor expanded in d_2 around 0
lower-pow.f64
100.0
Applied rewrites100.0%
(FPCore (t d_1 d_2) :precision binary64 (pow 0.1 (- d_2 d_1)))
double code(double t, double d_1, double d_2) { return pow(0.1, (d_2 - d_1)); }
real(8) function code(t, d_1, d_2) real(8), intent (in) :: t real(8), intent (in) :: d_1 real(8), intent (in) :: d_2 code = 0.1d0 ** (d_2 - d_1) end function
public static double code(double t, double d_1, double d_2) { return Math.pow(0.1, (d_2 - d_1)); }
def code(t, d_1, d_2): return math.pow(0.1, (d_2 - d_1))
function code(t, d_1, d_2) return 0.1 ^ Float64(d_2 - d_1) end
function tmp = code(t, d_1, d_2) tmp = 0.1 ^ (d_2 - d_1); end
code[t_, d$95$1_, d$95$2_] := N[Power[0.1, N[(d$95$2 - d$95$1), $MachinePrecision]], $MachinePrecision]
\begin{array}{l} \\ {0.1}^{\left(d\_2 - d\_1\right)} \end{array}
Initial program 100.0%
Taylor expanded in t around 0
exp-to-pow
N/A
sub-neg
N/A
mul-1-neg
N/A
+-commutative
N/A
mul-1-neg
N/A
remove-double-neg
N/A
mul-1-neg
N/A
distribute-neg-in
N/A
exp-to-pow
N/A
distribute-rgt-neg-in
N/A
mul-1-neg
N/A
associate-*r*
N/A
exp-prod
N/A
lower-pow.f64
N/A
*-commutative
N/A
exp-to-pow
N/A
metadata-eval
N/A
mul-1-neg
N/A
unsub-neg
N/A
lower--.f64
96.9
Applied rewrites96.9%
(FPCore (t d_1 d_2) :precision binary64 (pow 0.1 d_2))
double code(double t, double d_1, double d_2) { return pow(0.1, d_2); }
real(8) function code(t, d_1, d_2) real(8), intent (in) :: t real(8), intent (in) :: d_1 real(8), intent (in) :: d_2 code = 0.1d0 ** d_2 end function
public static double code(double t, double d_1, double d_2) { return Math.pow(0.1, d_2); }
def code(t, d_1, d_2): return math.pow(0.1, d_2)
function code(t, d_1, d_2) return 0.1 ^ d_2 end
function tmp = code(t, d_1, d_2) tmp = 0.1 ^ d_2; end
code[t_, d$95$1_, d$95$2_] := N[Power[0.1, d$95$2], $MachinePrecision]
\begin{array}{l} \\ {0.1}^{d\_2} \end{array}
Initial program 100.0%
Taylor expanded in t around 0
exp-to-pow
N/A
sub-neg
N/A
mul-1-neg
N/A
+-commutative
N/A
mul-1-neg
N/A
remove-double-neg
N/A
mul-1-neg
N/A
distribute-neg-in
N/A
exp-to-pow
N/A
distribute-rgt-neg-in
N/A
mul-1-neg
N/A
associate-*r*
N/A
exp-prod
N/A
lower-pow.f64
N/A
*-commutative
N/A
exp-to-pow
N/A
metadata-eval
N/A
mul-1-neg
N/A
unsub-neg
N/A
lower--.f64
96.9
Applied rewrites96.9%
Taylor expanded in d_1 around 0
Applied rewrites95.2%
herbie shell --seed 1
(FPCore (t d_1 d_2)
:name "sqrt(1.0001 ^ t) * 10 ^ (d_1 - d_2)"
:precision binary64
:pre (and (and (and (<= -887272.0 t) (<= t 887272.0)) (and (<= 0.0 d_1) (<= d_1 20.0))) (and (<= 0.0 d_2) (<= d_2 20.0)))
(* (sqrt (pow 1.0001 t)) (pow 10.0 (- d_1 d_2))))