sqrt(1.0001 ^ t) * 10 ^ (d_1 - d_2)

Percentage Accurate: 100.0% → 100.0%
Time: 4.1s
Alternatives: 5
Speedup: 1.0×

Specification

?
\[\left(\left(-887272 \leq t \land t \leq 887272\right) \land \left(0 \leq d\_1 \land d\_1 \leq 20\right)\right) \land \left(0 \leq d\_2 \land d\_2 \leq 20\right)\]
\[\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
 (* (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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 5 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

\[\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
 (* (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}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ {1.0001}^{\left(0.5 \cdot t\right)} \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}
Derivation
  1. Initial program 100.0%

    \[\sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-sqrt.f64N/A

      \[\leadsto \color{blue}{\sqrt{{\frac{4504049987333233}{4503599627370496}}^{t}}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto \sqrt{\color{blue}{{\frac{4504049987333233}{4503599627370496}}^{t}}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
    3. sqrt-pow1N/A

      \[\leadsto \color{blue}{{\frac{4504049987333233}{4503599627370496}}^{\left(\frac{t}{2}\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
    4. lower-pow.f64N/A

      \[\leadsto \color{blue}{{\frac{4504049987333233}{4503599627370496}}^{\left(\frac{t}{2}\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
    5. div-invN/A

      \[\leadsto {\frac{4504049987333233}{4503599627370496}}^{\color{blue}{\left(t \cdot \frac{1}{2}\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
    6. metadata-evalN/A

      \[\leadsto {\frac{4504049987333233}{4503599627370496}}^{\left(t \cdot \color{blue}{\frac{1}{2}}\right)} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
    7. *-commutativeN/A

      \[\leadsto {\frac{4504049987333233}{4503599627370496}}^{\color{blue}{\left(\frac{1}{2} \cdot t\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
    8. lower-*.f64100.0

      \[\leadsto {1.0001}^{\color{blue}{\left(0.5 \cdot t\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{{1.0001}^{\left(0.5 \cdot t\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
  5. Add Preprocessing

Alternative 2: 97.3% accurate, 0.7× speedup?

\[\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} \]
(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}
Derivation
  1. Split input into 2 regimes
  2. 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

    1. Initial program 99.8%

      \[\sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0

      \[\leadsto \color{blue}{e^{\log 10 \cdot \left(d\_1 - d\_2\right)}} \]
    4. Step-by-step derivation
      1. exp-to-powN/A

        \[\leadsto \color{blue}{{10}^{\left(d\_1 - d\_2\right)}} \]
      2. sub-negN/A

        \[\leadsto {10}^{\color{blue}{\left(d\_1 + \left(\mathsf{neg}\left(d\_2\right)\right)\right)}} \]
      3. mul-1-negN/A

        \[\leadsto {10}^{\left(d\_1 + \color{blue}{-1 \cdot d\_2}\right)} \]
      4. +-commutativeN/A

        \[\leadsto {10}^{\color{blue}{\left(-1 \cdot d\_2 + d\_1\right)}} \]
      5. mul-1-negN/A

        \[\leadsto {10}^{\left(\color{blue}{\left(\mathsf{neg}\left(d\_2\right)\right)} + d\_1\right)} \]
      6. remove-double-negN/A

        \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(d\_1\right)\right)\right)\right)}\right)} \]
      7. mul-1-negN/A

        \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot d\_1}\right)\right)\right)} \]
      8. distribute-neg-inN/A

        \[\leadsto {10}^{\color{blue}{\left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
      9. exp-to-powN/A

        \[\leadsto \color{blue}{e^{\log 10 \cdot \left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto e^{\color{blue}{\mathsf{neg}\left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
      11. mul-1-negN/A

        \[\leadsto e^{\color{blue}{-1 \cdot \left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
      12. associate-*r*N/A

        \[\leadsto e^{\color{blue}{\left(-1 \cdot \log 10\right) \cdot \left(d\_2 + -1 \cdot d\_1\right)}} \]
      13. exp-prodN/A

        \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
      14. lower-pow.f64N/A

        \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
      15. *-commutativeN/A

        \[\leadsto {\left(e^{\color{blue}{\log 10 \cdot -1}}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
      16. exp-to-powN/A

        \[\leadsto {\color{blue}{\left({10}^{-1}\right)}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
      17. metadata-evalN/A

        \[\leadsto {\color{blue}{\frac{1}{10}}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
      18. mul-1-negN/A

        \[\leadsto {\frac{1}{10}}^{\left(d\_2 + \color{blue}{\left(\mathsf{neg}\left(d\_1\right)\right)}\right)} \]
      19. unsub-negN/A

        \[\leadsto {\frac{1}{10}}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
      20. lower--.f6481.1

        \[\leadsto {0.1}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
    5. Applied rewrites81.1%

      \[\leadsto \color{blue}{{0.1}^{\left(d\_2 - d\_1\right)}} \]
    6. Taylor expanded in d_1 around 0

      \[\leadsto {\frac{1}{10}}^{\color{blue}{d\_2}} \]
    7. Step-by-step derivation
      1. Applied rewrites81.1%

        \[\leadsto {0.1}^{\color{blue}{d\_2}} \]

      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)))

      1. Initial program 100.0%

        \[\sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in t around 0

        \[\leadsto \color{blue}{e^{\log 10 \cdot \left(d\_1 - d\_2\right)}} \]
      4. Step-by-step derivation
        1. exp-to-powN/A

          \[\leadsto \color{blue}{{10}^{\left(d\_1 - d\_2\right)}} \]
        2. sub-negN/A

          \[\leadsto {10}^{\color{blue}{\left(d\_1 + \left(\mathsf{neg}\left(d\_2\right)\right)\right)}} \]
        3. mul-1-negN/A

          \[\leadsto {10}^{\left(d\_1 + \color{blue}{-1 \cdot d\_2}\right)} \]
        4. +-commutativeN/A

          \[\leadsto {10}^{\color{blue}{\left(-1 \cdot d\_2 + d\_1\right)}} \]
        5. mul-1-negN/A

          \[\leadsto {10}^{\left(\color{blue}{\left(\mathsf{neg}\left(d\_2\right)\right)} + d\_1\right)} \]
        6. remove-double-negN/A

          \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(d\_1\right)\right)\right)\right)}\right)} \]
        7. mul-1-negN/A

          \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot d\_1}\right)\right)\right)} \]
        8. distribute-neg-inN/A

          \[\leadsto {10}^{\color{blue}{\left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
        9. exp-to-powN/A

          \[\leadsto \color{blue}{e^{\log 10 \cdot \left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
        10. distribute-rgt-neg-inN/A

          \[\leadsto e^{\color{blue}{\mathsf{neg}\left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
        11. mul-1-negN/A

          \[\leadsto e^{\color{blue}{-1 \cdot \left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
        12. associate-*r*N/A

          \[\leadsto e^{\color{blue}{\left(-1 \cdot \log 10\right) \cdot \left(d\_2 + -1 \cdot d\_1\right)}} \]
        13. exp-prodN/A

          \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
        14. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
        15. *-commutativeN/A

          \[\leadsto {\left(e^{\color{blue}{\log 10 \cdot -1}}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
        16. exp-to-powN/A

          \[\leadsto {\color{blue}{\left({10}^{-1}\right)}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
        17. metadata-evalN/A

          \[\leadsto {\color{blue}{\frac{1}{10}}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
        18. mul-1-negN/A

          \[\leadsto {\frac{1}{10}}^{\left(d\_2 + \color{blue}{\left(\mathsf{neg}\left(d\_1\right)\right)}\right)} \]
        19. unsub-negN/A

          \[\leadsto {\frac{1}{10}}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
        20. lower--.f6498.2

          \[\leadsto {0.1}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
      5. Applied rewrites98.2%

        \[\leadsto \color{blue}{{0.1}^{\left(d\_2 - d\_1\right)}} \]
      6. Taylor expanded in d_2 around 0

        \[\leadsto e^{-1 \cdot \left(d\_1 \cdot \log \frac{1}{10}\right)} \]
      7. Step-by-step derivation
        1. Applied rewrites98.2%

          \[\leadsto {10}^{\color{blue}{d\_1}} \]
      8. Recombined 2 regimes into one program.
      9. Add Preprocessing

      Alternative 3: 99.7% accurate, 1.0× speedup?

      \[\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} \]
      (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}
      
      Derivation
      1. Split input into 2 regimes
      2. if (-.f64 d_1 d_2) < -2.00000000000000014e-17

        1. Initial program 100.0%

          \[\sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in t around 0

          \[\leadsto \color{blue}{e^{\log 10 \cdot \left(d\_1 - d\_2\right)}} \]
        4. Step-by-step derivation
          1. exp-to-powN/A

            \[\leadsto \color{blue}{{10}^{\left(d\_1 - d\_2\right)}} \]
          2. sub-negN/A

            \[\leadsto {10}^{\color{blue}{\left(d\_1 + \left(\mathsf{neg}\left(d\_2\right)\right)\right)}} \]
          3. mul-1-negN/A

            \[\leadsto {10}^{\left(d\_1 + \color{blue}{-1 \cdot d\_2}\right)} \]
          4. +-commutativeN/A

            \[\leadsto {10}^{\color{blue}{\left(-1 \cdot d\_2 + d\_1\right)}} \]
          5. mul-1-negN/A

            \[\leadsto {10}^{\left(\color{blue}{\left(\mathsf{neg}\left(d\_2\right)\right)} + d\_1\right)} \]
          6. remove-double-negN/A

            \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(d\_1\right)\right)\right)\right)}\right)} \]
          7. mul-1-negN/A

            \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot d\_1}\right)\right)\right)} \]
          8. distribute-neg-inN/A

            \[\leadsto {10}^{\color{blue}{\left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
          9. exp-to-powN/A

            \[\leadsto \color{blue}{e^{\log 10 \cdot \left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
          10. distribute-rgt-neg-inN/A

            \[\leadsto e^{\color{blue}{\mathsf{neg}\left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
          11. mul-1-negN/A

            \[\leadsto e^{\color{blue}{-1 \cdot \left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
          12. associate-*r*N/A

            \[\leadsto e^{\color{blue}{\left(-1 \cdot \log 10\right) \cdot \left(d\_2 + -1 \cdot d\_1\right)}} \]
          13. exp-prodN/A

            \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
          14. lower-pow.f64N/A

            \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
          15. *-commutativeN/A

            \[\leadsto {\left(e^{\color{blue}{\log 10 \cdot -1}}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          16. exp-to-powN/A

            \[\leadsto {\color{blue}{\left({10}^{-1}\right)}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          17. metadata-evalN/A

            \[\leadsto {\color{blue}{\frac{1}{10}}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          18. mul-1-negN/A

            \[\leadsto {\frac{1}{10}}^{\left(d\_2 + \color{blue}{\left(\mathsf{neg}\left(d\_1\right)\right)}\right)} \]
          19. unsub-negN/A

            \[\leadsto {\frac{1}{10}}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
          20. lower--.f64100.0

            \[\leadsto {0.1}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
        5. Applied rewrites100.0%

          \[\leadsto \color{blue}{{0.1}^{\left(d\_2 - d\_1\right)}} \]
        6. Taylor expanded in d_1 around 0

          \[\leadsto {\frac{1}{10}}^{\color{blue}{d\_2}} \]
        7. Step-by-step derivation
          1. Applied rewrites100.0%

            \[\leadsto {0.1}^{\color{blue}{d\_2}} \]

          if -2.00000000000000014e-17 < (-.f64 d_1 d_2)

          1. Initial program 100.0%

            \[\sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \color{blue}{\sqrt{{\frac{4504049987333233}{4503599627370496}}^{t}}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
            2. lift-pow.f64N/A

              \[\leadsto \sqrt{\color{blue}{{\frac{4504049987333233}{4503599627370496}}^{t}}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
            3. sqrt-pow1N/A

              \[\leadsto \color{blue}{{\frac{4504049987333233}{4503599627370496}}^{\left(\frac{t}{2}\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
            4. lower-pow.f64N/A

              \[\leadsto \color{blue}{{\frac{4504049987333233}{4503599627370496}}^{\left(\frac{t}{2}\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
            5. div-invN/A

              \[\leadsto {\frac{4504049987333233}{4503599627370496}}^{\color{blue}{\left(t \cdot \frac{1}{2}\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
            6. metadata-evalN/A

              \[\leadsto {\frac{4504049987333233}{4503599627370496}}^{\left(t \cdot \color{blue}{\frac{1}{2}}\right)} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
            7. *-commutativeN/A

              \[\leadsto {\frac{4504049987333233}{4503599627370496}}^{\color{blue}{\left(\frac{1}{2} \cdot t\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
            8. lower-*.f64100.0

              \[\leadsto {1.0001}^{\color{blue}{\left(0.5 \cdot t\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
          4. Applied rewrites100.0%

            \[\leadsto \color{blue}{{1.0001}^{\left(0.5 \cdot t\right)}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
          5. Taylor expanded in d_2 around 0

            \[\leadsto {\frac{4504049987333233}{4503599627370496}}^{\left(\frac{1}{2} \cdot t\right)} \cdot \color{blue}{{10}^{d\_1}} \]
          6. Step-by-step derivation
            1. lower-pow.f64100.0

              \[\leadsto {1.0001}^{\left(0.5 \cdot t\right)} \cdot \color{blue}{{10}^{d\_1}} \]
          7. Applied rewrites100.0%

            \[\leadsto {1.0001}^{\left(0.5 \cdot t\right)} \cdot \color{blue}{{10}^{d\_1}} \]
        8. Recombined 2 regimes into one program.
        9. Add Preprocessing

        Alternative 4: 97.4% accurate, 2.1× speedup?

        \[\begin{array}{l} \\ {0.1}^{\left(d\_2 - d\_1\right)} \end{array} \]
        (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}
        
        Derivation
        1. Initial program 100.0%

          \[\sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in t around 0

          \[\leadsto \color{blue}{e^{\log 10 \cdot \left(d\_1 - d\_2\right)}} \]
        4. Step-by-step derivation
          1. exp-to-powN/A

            \[\leadsto \color{blue}{{10}^{\left(d\_1 - d\_2\right)}} \]
          2. sub-negN/A

            \[\leadsto {10}^{\color{blue}{\left(d\_1 + \left(\mathsf{neg}\left(d\_2\right)\right)\right)}} \]
          3. mul-1-negN/A

            \[\leadsto {10}^{\left(d\_1 + \color{blue}{-1 \cdot d\_2}\right)} \]
          4. +-commutativeN/A

            \[\leadsto {10}^{\color{blue}{\left(-1 \cdot d\_2 + d\_1\right)}} \]
          5. mul-1-negN/A

            \[\leadsto {10}^{\left(\color{blue}{\left(\mathsf{neg}\left(d\_2\right)\right)} + d\_1\right)} \]
          6. remove-double-negN/A

            \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(d\_1\right)\right)\right)\right)}\right)} \]
          7. mul-1-negN/A

            \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot d\_1}\right)\right)\right)} \]
          8. distribute-neg-inN/A

            \[\leadsto {10}^{\color{blue}{\left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
          9. exp-to-powN/A

            \[\leadsto \color{blue}{e^{\log 10 \cdot \left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
          10. distribute-rgt-neg-inN/A

            \[\leadsto e^{\color{blue}{\mathsf{neg}\left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
          11. mul-1-negN/A

            \[\leadsto e^{\color{blue}{-1 \cdot \left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
          12. associate-*r*N/A

            \[\leadsto e^{\color{blue}{\left(-1 \cdot \log 10\right) \cdot \left(d\_2 + -1 \cdot d\_1\right)}} \]
          13. exp-prodN/A

            \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
          14. lower-pow.f64N/A

            \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
          15. *-commutativeN/A

            \[\leadsto {\left(e^{\color{blue}{\log 10 \cdot -1}}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          16. exp-to-powN/A

            \[\leadsto {\color{blue}{\left({10}^{-1}\right)}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          17. metadata-evalN/A

            \[\leadsto {\color{blue}{\frac{1}{10}}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          18. mul-1-negN/A

            \[\leadsto {\frac{1}{10}}^{\left(d\_2 + \color{blue}{\left(\mathsf{neg}\left(d\_1\right)\right)}\right)} \]
          19. unsub-negN/A

            \[\leadsto {\frac{1}{10}}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
          20. lower--.f6496.9

            \[\leadsto {0.1}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
        5. Applied rewrites96.9%

          \[\leadsto \color{blue}{{0.1}^{\left(d\_2 - d\_1\right)}} \]
        6. Add Preprocessing

        Alternative 5: 95.2% accurate, 2.2× speedup?

        \[\begin{array}{l} \\ {0.1}^{d\_2} \end{array} \]
        (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}
        
        Derivation
        1. Initial program 100.0%

          \[\sqrt{{1.0001}^{t}} \cdot {10}^{\left(d\_1 - d\_2\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in t around 0

          \[\leadsto \color{blue}{e^{\log 10 \cdot \left(d\_1 - d\_2\right)}} \]
        4. Step-by-step derivation
          1. exp-to-powN/A

            \[\leadsto \color{blue}{{10}^{\left(d\_1 - d\_2\right)}} \]
          2. sub-negN/A

            \[\leadsto {10}^{\color{blue}{\left(d\_1 + \left(\mathsf{neg}\left(d\_2\right)\right)\right)}} \]
          3. mul-1-negN/A

            \[\leadsto {10}^{\left(d\_1 + \color{blue}{-1 \cdot d\_2}\right)} \]
          4. +-commutativeN/A

            \[\leadsto {10}^{\color{blue}{\left(-1 \cdot d\_2 + d\_1\right)}} \]
          5. mul-1-negN/A

            \[\leadsto {10}^{\left(\color{blue}{\left(\mathsf{neg}\left(d\_2\right)\right)} + d\_1\right)} \]
          6. remove-double-negN/A

            \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(d\_1\right)\right)\right)\right)}\right)} \]
          7. mul-1-negN/A

            \[\leadsto {10}^{\left(\left(\mathsf{neg}\left(d\_2\right)\right) + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot d\_1}\right)\right)\right)} \]
          8. distribute-neg-inN/A

            \[\leadsto {10}^{\color{blue}{\left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
          9. exp-to-powN/A

            \[\leadsto \color{blue}{e^{\log 10 \cdot \left(\mathsf{neg}\left(\left(d\_2 + -1 \cdot d\_1\right)\right)\right)}} \]
          10. distribute-rgt-neg-inN/A

            \[\leadsto e^{\color{blue}{\mathsf{neg}\left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
          11. mul-1-negN/A

            \[\leadsto e^{\color{blue}{-1 \cdot \left(\log 10 \cdot \left(d\_2 + -1 \cdot d\_1\right)\right)}} \]
          12. associate-*r*N/A

            \[\leadsto e^{\color{blue}{\left(-1 \cdot \log 10\right) \cdot \left(d\_2 + -1 \cdot d\_1\right)}} \]
          13. exp-prodN/A

            \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
          14. lower-pow.f64N/A

            \[\leadsto \color{blue}{{\left(e^{-1 \cdot \log 10}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)}} \]
          15. *-commutativeN/A

            \[\leadsto {\left(e^{\color{blue}{\log 10 \cdot -1}}\right)}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          16. exp-to-powN/A

            \[\leadsto {\color{blue}{\left({10}^{-1}\right)}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          17. metadata-evalN/A

            \[\leadsto {\color{blue}{\frac{1}{10}}}^{\left(d\_2 + -1 \cdot d\_1\right)} \]
          18. mul-1-negN/A

            \[\leadsto {\frac{1}{10}}^{\left(d\_2 + \color{blue}{\left(\mathsf{neg}\left(d\_1\right)\right)}\right)} \]
          19. unsub-negN/A

            \[\leadsto {\frac{1}{10}}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
          20. lower--.f6496.9

            \[\leadsto {0.1}^{\color{blue}{\left(d\_2 - d\_1\right)}} \]
        5. Applied rewrites96.9%

          \[\leadsto \color{blue}{{0.1}^{\left(d\_2 - d\_1\right)}} \]
        6. Taylor expanded in d_1 around 0

          \[\leadsto {\frac{1}{10}}^{\color{blue}{d\_2}} \]
        7. Step-by-step derivation
          1. Applied rewrites95.2%

            \[\leadsto {0.1}^{\color{blue}{d\_2}} \]
          2. Add Preprocessing

          Reproduce

          ?
          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))))