Octave 3.8, oct_fill_randg

Percentage Accurate: 99.7% → 99.8%
Time: 12.0s
Alternatives: 10
Speedup: 2.4×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := a - \frac{1}{3}\\ t\_0 \cdot \left(1 + \frac{1}{\sqrt{9 \cdot t\_0}} \cdot rand\right) \end{array} \end{array} \]
(FPCore (a rand)
 :precision binary64
 (let* ((t_0 (- a (/ 1.0 3.0))))
   (* t_0 (+ 1.0 (* (/ 1.0 (sqrt (* 9.0 t_0))) rand)))))
double code(double a, double rand) {
	double t_0 = a - (1.0 / 3.0);
	return t_0 * (1.0 + ((1.0 / sqrt((9.0 * t_0))) * rand));
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    real(8) :: t_0
    t_0 = a - (1.0d0 / 3.0d0)
    code = t_0 * (1.0d0 + ((1.0d0 / sqrt((9.0d0 * t_0))) * rand))
end function
public static double code(double a, double rand) {
	double t_0 = a - (1.0 / 3.0);
	return t_0 * (1.0 + ((1.0 / Math.sqrt((9.0 * t_0))) * rand));
}
def code(a, rand):
	t_0 = a - (1.0 / 3.0)
	return t_0 * (1.0 + ((1.0 / math.sqrt((9.0 * t_0))) * rand))
function code(a, rand)
	t_0 = Float64(a - Float64(1.0 / 3.0))
	return Float64(t_0 * Float64(1.0 + Float64(Float64(1.0 / sqrt(Float64(9.0 * t_0))) * rand)))
end
function tmp = code(a, rand)
	t_0 = a - (1.0 / 3.0);
	tmp = t_0 * (1.0 + ((1.0 / sqrt((9.0 * t_0))) * rand));
end
code[a_, rand_] := Block[{t$95$0 = N[(a - N[(1.0 / 3.0), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * N[(1.0 + N[(N[(1.0 / N[Sqrt[N[(9.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * rand), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a - \frac{1}{3}\\
t\_0 \cdot \left(1 + \frac{1}{\sqrt{9 \cdot t\_0}} \cdot rand\right)
\end{array}
\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 10 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: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a - \frac{1}{3}\\ t\_0 \cdot \left(1 + \frac{1}{\sqrt{9 \cdot t\_0}} \cdot rand\right) \end{array} \end{array} \]
(FPCore (a rand)
 :precision binary64
 (let* ((t_0 (- a (/ 1.0 3.0))))
   (* t_0 (+ 1.0 (* (/ 1.0 (sqrt (* 9.0 t_0))) rand)))))
double code(double a, double rand) {
	double t_0 = a - (1.0 / 3.0);
	return t_0 * (1.0 + ((1.0 / sqrt((9.0 * t_0))) * rand));
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    real(8) :: t_0
    t_0 = a - (1.0d0 / 3.0d0)
    code = t_0 * (1.0d0 + ((1.0d0 / sqrt((9.0d0 * t_0))) * rand))
end function
public static double code(double a, double rand) {
	double t_0 = a - (1.0 / 3.0);
	return t_0 * (1.0 + ((1.0 / Math.sqrt((9.0 * t_0))) * rand));
}
def code(a, rand):
	t_0 = a - (1.0 / 3.0)
	return t_0 * (1.0 + ((1.0 / math.sqrt((9.0 * t_0))) * rand))
function code(a, rand)
	t_0 = Float64(a - Float64(1.0 / 3.0))
	return Float64(t_0 * Float64(1.0 + Float64(Float64(1.0 / sqrt(Float64(9.0 * t_0))) * rand)))
end
function tmp = code(a, rand)
	t_0 = a - (1.0 / 3.0);
	tmp = t_0 * (1.0 + ((1.0 / sqrt((9.0 * t_0))) * rand));
end
code[a_, rand_] := Block[{t$95$0 = N[(a - N[(1.0 / 3.0), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * N[(1.0 + N[(N[(1.0 / N[Sqrt[N[(9.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * rand), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a - \frac{1}{3}\\
t\_0 \cdot \left(1 + \frac{1}{\sqrt{9 \cdot t\_0}} \cdot rand\right)
\end{array}
\end{array}

Alternative 1: 99.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \left(a + \frac{-1}{3}\right) \cdot \left(1 - \frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right) \end{array} \]
(FPCore (a rand)
 :precision binary64
 (*
  (+ a (/ -1.0 3.0))
  (- 1.0 (/ rand (* (sqrt (+ a -0.3333333333333333)) -3.0)))))
double code(double a, double rand) {
	return (a + (-1.0 / 3.0)) * (1.0 - (rand / (sqrt((a + -0.3333333333333333)) * -3.0)));
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    code = (a + ((-1.0d0) / 3.0d0)) * (1.0d0 - (rand / (sqrt((a + (-0.3333333333333333d0))) * (-3.0d0))))
end function
public static double code(double a, double rand) {
	return (a + (-1.0 / 3.0)) * (1.0 - (rand / (Math.sqrt((a + -0.3333333333333333)) * -3.0)));
}
def code(a, rand):
	return (a + (-1.0 / 3.0)) * (1.0 - (rand / (math.sqrt((a + -0.3333333333333333)) * -3.0)))
function code(a, rand)
	return Float64(Float64(a + Float64(-1.0 / 3.0)) * Float64(1.0 - Float64(rand / Float64(sqrt(Float64(a + -0.3333333333333333)) * -3.0))))
end
function tmp = code(a, rand)
	tmp = (a + (-1.0 / 3.0)) * (1.0 - (rand / (sqrt((a + -0.3333333333333333)) * -3.0)));
end
code[a_, rand_] := N[(N[(a + N[(-1.0 / 3.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(rand / N[(N[Sqrt[N[(a + -0.3333333333333333), $MachinePrecision]], $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(a + \frac{-1}{3}\right) \cdot \left(1 - \frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
    2. frac-2negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
    3. *-lft-identityN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
    4. distribute-frac-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
    5. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
    8. sqrt-prodN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
    10. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    12. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    13. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    14. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    17. metadata-eval99.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
  4. Applied egg-rr99.9%

    \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
  5. Final simplification99.9%

    \[\leadsto \left(a + \frac{-1}{3}\right) \cdot \left(1 - \frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right) \]
  6. Add Preprocessing

Alternative 2: 99.7% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\mathsf{fma}\left(a, 9, -3\right)}}\right) \end{array} \]
(FPCore (a rand)
 :precision binary64
 (* (+ a -0.3333333333333333) (+ 1.0 (/ rand (sqrt (fma a 9.0 -3.0))))))
double code(double a, double rand) {
	return (a + -0.3333333333333333) * (1.0 + (rand / sqrt(fma(a, 9.0, -3.0))));
}
function code(a, rand)
	return Float64(Float64(a + -0.3333333333333333) * Float64(1.0 + Float64(rand / sqrt(fma(a, 9.0, -3.0)))))
end
code[a_, rand_] := N[(N[(a + -0.3333333333333333), $MachinePrecision] * N[(1.0 + N[(rand / N[Sqrt[N[(a * 9.0 + -3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\mathsf{fma}\left(a, 9, -3\right)}}\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
    2. frac-2negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
    3. *-lft-identityN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
    4. distribute-frac-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
    5. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
    8. sqrt-prodN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
    10. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    12. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    13. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    14. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
    17. metadata-eval99.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
  4. Applied egg-rr99.9%

    \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
  5. Step-by-step derivation
    1. distribute-lft-inN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \color{blue}{\left(a - \frac{1}{3}\right) \cdot \left(\mathsf{neg}\left(\frac{rand}{\sqrt{a + \frac{-1}{3}} \cdot -3}\right)\right)} \]
    2. distribute-neg-frac2N/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{\color{blue}{\mathsf{neg}\left(\sqrt{a + \frac{-1}{3}} \cdot -3\right)}} \]
    3. *-commutativeN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{\mathsf{neg}\left(-3 \cdot \sqrt{a + \frac{-1}{3}}\right)} \]
    4. distribute-lft-neg-inN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{\left(\mathsf{neg}\left(-3\right)\right) \cdot \color{blue}{\sqrt{a + \frac{-1}{3}}}} \]
    5. metadata-evalN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{3 \cdot \sqrt{\color{blue}{a + \frac{-1}{3}}}} \]
    6. metadata-evalN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{\sqrt{9} \cdot \sqrt{\color{blue}{a + \frac{-1}{3}}}} \]
    7. metadata-evalN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{\sqrt{9} \cdot \sqrt{a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}} \]
    8. metadata-evalN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{\sqrt{9} \cdot \sqrt{a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}} \]
    9. sub-negN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{\sqrt{9} \cdot \sqrt{a - \frac{1}{3}}} \]
    10. sqrt-prodN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \frac{rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \]
    11. un-div-invN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \left(rand \cdot \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
    12. *-commutativeN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot 1 + \left(a - \frac{1}{3}\right) \cdot \left(\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot \color{blue}{rand}\right) \]
    13. distribute-lft-inN/A

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot \color{blue}{\left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)} \]
    14. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(a - \frac{1}{3}\right), \color{blue}{\left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)}\right) \]
  6. Applied egg-rr99.9%

    \[\leadsto \color{blue}{\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\mathsf{fma}\left(a, 9, -3\right)}}\right)} \]
  7. Add Preprocessing

Alternative 3: 92.0% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := rand \cdot \left(0.3333333333333333 \cdot \sqrt{a}\right)\\ \mathbf{if}\;rand \leq -2.25 \cdot 10^{+70}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;rand \leq 9.2 \cdot 10^{+83}:\\ \;\;\;\;a + -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a rand)
 :precision binary64
 (let* ((t_0 (* rand (* 0.3333333333333333 (sqrt a)))))
   (if (<= rand -2.25e+70)
     t_0
     (if (<= rand 9.2e+83) (+ a -0.3333333333333333) t_0))))
double code(double a, double rand) {
	double t_0 = rand * (0.3333333333333333 * sqrt(a));
	double tmp;
	if (rand <= -2.25e+70) {
		tmp = t_0;
	} else if (rand <= 9.2e+83) {
		tmp = a + -0.3333333333333333;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    real(8) :: t_0
    real(8) :: tmp
    t_0 = rand * (0.3333333333333333d0 * sqrt(a))
    if (rand <= (-2.25d+70)) then
        tmp = t_0
    else if (rand <= 9.2d+83) then
        tmp = a + (-0.3333333333333333d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double rand) {
	double t_0 = rand * (0.3333333333333333 * Math.sqrt(a));
	double tmp;
	if (rand <= -2.25e+70) {
		tmp = t_0;
	} else if (rand <= 9.2e+83) {
		tmp = a + -0.3333333333333333;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, rand):
	t_0 = rand * (0.3333333333333333 * math.sqrt(a))
	tmp = 0
	if rand <= -2.25e+70:
		tmp = t_0
	elif rand <= 9.2e+83:
		tmp = a + -0.3333333333333333
	else:
		tmp = t_0
	return tmp
function code(a, rand)
	t_0 = Float64(rand * Float64(0.3333333333333333 * sqrt(a)))
	tmp = 0.0
	if (rand <= -2.25e+70)
		tmp = t_0;
	elseif (rand <= 9.2e+83)
		tmp = Float64(a + -0.3333333333333333);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, rand)
	t_0 = rand * (0.3333333333333333 * sqrt(a));
	tmp = 0.0;
	if (rand <= -2.25e+70)
		tmp = t_0;
	elseif (rand <= 9.2e+83)
		tmp = a + -0.3333333333333333;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, rand_] := Block[{t$95$0 = N[(rand * N[(0.3333333333333333 * N[Sqrt[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[rand, -2.25e+70], t$95$0, If[LessEqual[rand, 9.2e+83], N[(a + -0.3333333333333333), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := rand \cdot \left(0.3333333333333333 \cdot \sqrt{a}\right)\\
\mathbf{if}\;rand \leq -2.25 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;rand \leq 9.2 \cdot 10^{+83}:\\
\;\;\;\;a + -0.3333333333333333\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if rand < -2.25e70 or 9.1999999999999998e83 < rand

    1. Initial program 99.6%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
      2. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
      3. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
      4. distribute-frac-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-eval99.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
    5. Taylor expanded in rand around inf

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \left(rand \cdot \sqrt{a - \frac{1}{3}}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(rand \cdot \sqrt{a - \frac{1}{3}}\right) \cdot \color{blue}{\frac{1}{3}} \]
      2. *-commutativeN/A

        \[\leadsto \left(\sqrt{a - \frac{1}{3}} \cdot rand\right) \cdot \frac{1}{3} \]
      3. associate-*l*N/A

        \[\leadsto \sqrt{a - \frac{1}{3}} \cdot \color{blue}{\left(rand \cdot \frac{1}{3}\right)} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{a - \frac{1}{3}} \cdot \left(\frac{1}{3} \cdot \color{blue}{rand}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \color{blue}{\left(\frac{1}{3} \cdot rand\right)}\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\color{blue}{\frac{1}{3}} \cdot rand\right)\right) \]
      7. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \frac{-1}{3}\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
      10. *-lowering-*.f6493.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \mathsf{*.f64}\left(\frac{1}{3}, \color{blue}{rand}\right)\right) \]
    7. Simplified93.8%

      \[\leadsto \color{blue}{\sqrt{a + -0.3333333333333333} \cdot \left(0.3333333333333333 \cdot rand\right)} \]
    8. Taylor expanded in a around inf

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \left(\sqrt{a} \cdot rand\right)} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{3}, \color{blue}{\left(\sqrt{a} \cdot rand\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{3}, \left(rand \cdot \color{blue}{\sqrt{a}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(rand, \color{blue}{\left(\sqrt{a}\right)}\right)\right) \]
      4. sqrt-lowering-sqrt.f6490.1%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(rand, \mathsf{sqrt.f64}\left(a\right)\right)\right) \]
    10. Simplified90.1%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{1}{3} \cdot \left(\sqrt{a} \cdot \color{blue}{rand}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(\frac{1}{3} \cdot \sqrt{a}\right) \cdot \color{blue}{rand} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{3} \cdot \sqrt{a}\right), \color{blue}{rand}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{a} \cdot \frac{1}{3}\right), rand\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\sqrt{a}\right), \frac{1}{3}\right), rand\right) \]
      6. sqrt-lowering-sqrt.f6490.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(a\right), \frac{1}{3}\right), rand\right) \]
    12. Applied egg-rr90.3%

      \[\leadsto \color{blue}{\left(\sqrt{a} \cdot 0.3333333333333333\right) \cdot rand} \]

    if -2.25e70 < rand < 9.1999999999999998e83

    1. Initial program 99.9%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
      2. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
      3. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
      4. distribute-frac-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-eval100.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
    5. Taylor expanded in rand around 0

      \[\leadsto \color{blue}{a - \frac{1}{3}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto a + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto a + \frac{-1}{3} \]
      3. +-lowering-+.f6495.4%

        \[\leadsto \mathsf{+.f64}\left(a, \color{blue}{\frac{-1}{3}}\right) \]
    7. Simplified95.4%

      \[\leadsto \color{blue}{a + -0.3333333333333333} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;rand \leq -2.25 \cdot 10^{+70}:\\ \;\;\;\;rand \cdot \left(0.3333333333333333 \cdot \sqrt{a}\right)\\ \mathbf{elif}\;rand \leq 9.2 \cdot 10^{+83}:\\ \;\;\;\;a + -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;rand \cdot \left(0.3333333333333333 \cdot \sqrt{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 92.0% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(rand \cdot 0.3333333333333333\right) \cdot \sqrt{a}\\ \mathbf{if}\;rand \leq -2.4 \cdot 10^{+70}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;rand \leq 7.8 \cdot 10^{+83}:\\ \;\;\;\;a + -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a rand)
 :precision binary64
 (let* ((t_0 (* (* rand 0.3333333333333333) (sqrt a))))
   (if (<= rand -2.4e+70)
     t_0
     (if (<= rand 7.8e+83) (+ a -0.3333333333333333) t_0))))
double code(double a, double rand) {
	double t_0 = (rand * 0.3333333333333333) * sqrt(a);
	double tmp;
	if (rand <= -2.4e+70) {
		tmp = t_0;
	} else if (rand <= 7.8e+83) {
		tmp = a + -0.3333333333333333;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (rand * 0.3333333333333333d0) * sqrt(a)
    if (rand <= (-2.4d+70)) then
        tmp = t_0
    else if (rand <= 7.8d+83) then
        tmp = a + (-0.3333333333333333d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double rand) {
	double t_0 = (rand * 0.3333333333333333) * Math.sqrt(a);
	double tmp;
	if (rand <= -2.4e+70) {
		tmp = t_0;
	} else if (rand <= 7.8e+83) {
		tmp = a + -0.3333333333333333;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, rand):
	t_0 = (rand * 0.3333333333333333) * math.sqrt(a)
	tmp = 0
	if rand <= -2.4e+70:
		tmp = t_0
	elif rand <= 7.8e+83:
		tmp = a + -0.3333333333333333
	else:
		tmp = t_0
	return tmp
function code(a, rand)
	t_0 = Float64(Float64(rand * 0.3333333333333333) * sqrt(a))
	tmp = 0.0
	if (rand <= -2.4e+70)
		tmp = t_0;
	elseif (rand <= 7.8e+83)
		tmp = Float64(a + -0.3333333333333333);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, rand)
	t_0 = (rand * 0.3333333333333333) * sqrt(a);
	tmp = 0.0;
	if (rand <= -2.4e+70)
		tmp = t_0;
	elseif (rand <= 7.8e+83)
		tmp = a + -0.3333333333333333;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, rand_] := Block[{t$95$0 = N[(N[(rand * 0.3333333333333333), $MachinePrecision] * N[Sqrt[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[rand, -2.4e+70], t$95$0, If[LessEqual[rand, 7.8e+83], N[(a + -0.3333333333333333), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(rand \cdot 0.3333333333333333\right) \cdot \sqrt{a}\\
\mathbf{if}\;rand \leq -2.4 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;rand \leq 7.8 \cdot 10^{+83}:\\
\;\;\;\;a + -0.3333333333333333\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if rand < -2.39999999999999987e70 or 7.8000000000000003e83 < rand

    1. Initial program 99.6%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
      2. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
      3. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
      4. distribute-frac-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-eval99.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
    5. Taylor expanded in rand around inf

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \left(rand \cdot \sqrt{a - \frac{1}{3}}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(rand \cdot \sqrt{a - \frac{1}{3}}\right) \cdot \color{blue}{\frac{1}{3}} \]
      2. *-commutativeN/A

        \[\leadsto \left(\sqrt{a - \frac{1}{3}} \cdot rand\right) \cdot \frac{1}{3} \]
      3. associate-*l*N/A

        \[\leadsto \sqrt{a - \frac{1}{3}} \cdot \color{blue}{\left(rand \cdot \frac{1}{3}\right)} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{a - \frac{1}{3}} \cdot \left(\frac{1}{3} \cdot \color{blue}{rand}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \color{blue}{\left(\frac{1}{3} \cdot rand\right)}\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\color{blue}{\frac{1}{3}} \cdot rand\right)\right) \]
      7. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \frac{-1}{3}\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
      10. *-lowering-*.f6493.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \mathsf{*.f64}\left(\frac{1}{3}, \color{blue}{rand}\right)\right) \]
    7. Simplified93.8%

      \[\leadsto \color{blue}{\sqrt{a + -0.3333333333333333} \cdot \left(0.3333333333333333 \cdot rand\right)} \]
    8. Taylor expanded in a around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{a}\right), \mathsf{*.f64}\left(\frac{1}{3}, rand\right)\right) \]
    9. Step-by-step derivation
      1. Simplified90.3%

        \[\leadsto \sqrt{\color{blue}{a}} \cdot \left(0.3333333333333333 \cdot rand\right) \]

      if -2.39999999999999987e70 < rand < 7.8000000000000003e83

      1. Initial program 99.9%

        \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
        2. frac-2negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
        3. *-lft-identityN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
        4. distribute-frac-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
        5. neg-lowering-neg.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
        6. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
        8. sqrt-prodN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
        10. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        12. sqrt-lowering-sqrt.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        13. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        14. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        16. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        17. metadata-eval100.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
      4. Applied egg-rr100.0%

        \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
      5. Taylor expanded in rand around 0

        \[\leadsto \color{blue}{a - \frac{1}{3}} \]
      6. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto a + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)} \]
        2. metadata-evalN/A

          \[\leadsto a + \frac{-1}{3} \]
        3. +-lowering-+.f6495.4%

          \[\leadsto \mathsf{+.f64}\left(a, \color{blue}{\frac{-1}{3}}\right) \]
      7. Simplified95.4%

        \[\leadsto \color{blue}{a + -0.3333333333333333} \]
    10. Recombined 2 regimes into one program.
    11. Final simplification93.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;rand \leq -2.4 \cdot 10^{+70}:\\ \;\;\;\;\left(rand \cdot 0.3333333333333333\right) \cdot \sqrt{a}\\ \mathbf{elif}\;rand \leq 7.8 \cdot 10^{+83}:\\ \;\;\;\;a + -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;\left(rand \cdot 0.3333333333333333\right) \cdot \sqrt{a}\\ \end{array} \]
    12. Add Preprocessing

    Alternative 5: 91.9% accurate, 2.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)\\ \mathbf{if}\;rand \leq -3.15 \cdot 10^{+69}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;rand \leq 6.5 \cdot 10^{+83}:\\ \;\;\;\;a + -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (a rand)
     :precision binary64
     (let* ((t_0 (* 0.3333333333333333 (* rand (sqrt a)))))
       (if (<= rand -3.15e+69)
         t_0
         (if (<= rand 6.5e+83) (+ a -0.3333333333333333) t_0))))
    double code(double a, double rand) {
    	double t_0 = 0.3333333333333333 * (rand * sqrt(a));
    	double tmp;
    	if (rand <= -3.15e+69) {
    		tmp = t_0;
    	} else if (rand <= 6.5e+83) {
    		tmp = a + -0.3333333333333333;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(a, rand)
        real(8), intent (in) :: a
        real(8), intent (in) :: rand
        real(8) :: t_0
        real(8) :: tmp
        t_0 = 0.3333333333333333d0 * (rand * sqrt(a))
        if (rand <= (-3.15d+69)) then
            tmp = t_0
        else if (rand <= 6.5d+83) then
            tmp = a + (-0.3333333333333333d0)
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double a, double rand) {
    	double t_0 = 0.3333333333333333 * (rand * Math.sqrt(a));
    	double tmp;
    	if (rand <= -3.15e+69) {
    		tmp = t_0;
    	} else if (rand <= 6.5e+83) {
    		tmp = a + -0.3333333333333333;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(a, rand):
    	t_0 = 0.3333333333333333 * (rand * math.sqrt(a))
    	tmp = 0
    	if rand <= -3.15e+69:
    		tmp = t_0
    	elif rand <= 6.5e+83:
    		tmp = a + -0.3333333333333333
    	else:
    		tmp = t_0
    	return tmp
    
    function code(a, rand)
    	t_0 = Float64(0.3333333333333333 * Float64(rand * sqrt(a)))
    	tmp = 0.0
    	if (rand <= -3.15e+69)
    		tmp = t_0;
    	elseif (rand <= 6.5e+83)
    		tmp = Float64(a + -0.3333333333333333);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, rand)
    	t_0 = 0.3333333333333333 * (rand * sqrt(a));
    	tmp = 0.0;
    	if (rand <= -3.15e+69)
    		tmp = t_0;
    	elseif (rand <= 6.5e+83)
    		tmp = a + -0.3333333333333333;
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, rand_] := Block[{t$95$0 = N[(0.3333333333333333 * N[(rand * N[Sqrt[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[rand, -3.15e+69], t$95$0, If[LessEqual[rand, 6.5e+83], N[(a + -0.3333333333333333), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)\\
    \mathbf{if}\;rand \leq -3.15 \cdot 10^{+69}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;rand \leq 6.5 \cdot 10^{+83}:\\
    \;\;\;\;a + -0.3333333333333333\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if rand < -3.15000000000000004e69 or 6.5000000000000003e83 < rand

      1. Initial program 99.6%

        \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
        2. frac-2negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
        3. *-lft-identityN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
        4. distribute-frac-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
        5. neg-lowering-neg.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
        6. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
        8. sqrt-prodN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
        10. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        12. sqrt-lowering-sqrt.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        13. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        14. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        16. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        17. metadata-eval99.7%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
      4. Applied egg-rr99.7%

        \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
      5. Taylor expanded in rand around inf

        \[\leadsto \color{blue}{\frac{1}{3} \cdot \left(rand \cdot \sqrt{a - \frac{1}{3}}\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \left(rand \cdot \sqrt{a - \frac{1}{3}}\right) \cdot \color{blue}{\frac{1}{3}} \]
        2. *-commutativeN/A

          \[\leadsto \left(\sqrt{a - \frac{1}{3}} \cdot rand\right) \cdot \frac{1}{3} \]
        3. associate-*l*N/A

          \[\leadsto \sqrt{a - \frac{1}{3}} \cdot \color{blue}{\left(rand \cdot \frac{1}{3}\right)} \]
        4. *-commutativeN/A

          \[\leadsto \sqrt{a - \frac{1}{3}} \cdot \left(\frac{1}{3} \cdot \color{blue}{rand}\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \color{blue}{\left(\frac{1}{3} \cdot rand\right)}\right) \]
        6. sqrt-lowering-sqrt.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\color{blue}{\frac{1}{3}} \cdot rand\right)\right) \]
        7. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
        8. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \frac{-1}{3}\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
        9. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\frac{1}{3} \cdot rand\right)\right) \]
        10. *-lowering-*.f6493.8%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \mathsf{*.f64}\left(\frac{1}{3}, \color{blue}{rand}\right)\right) \]
      7. Simplified93.8%

        \[\leadsto \color{blue}{\sqrt{a + -0.3333333333333333} \cdot \left(0.3333333333333333 \cdot rand\right)} \]
      8. Taylor expanded in a around inf

        \[\leadsto \color{blue}{\frac{1}{3} \cdot \left(\sqrt{a} \cdot rand\right)} \]
      9. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{3}, \color{blue}{\left(\sqrt{a} \cdot rand\right)}\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{3}, \left(rand \cdot \color{blue}{\sqrt{a}}\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(rand, \color{blue}{\left(\sqrt{a}\right)}\right)\right) \]
        4. sqrt-lowering-sqrt.f6490.1%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(rand, \mathsf{sqrt.f64}\left(a\right)\right)\right) \]
      10. Simplified90.1%

        \[\leadsto \color{blue}{0.3333333333333333 \cdot \left(rand \cdot \sqrt{a}\right)} \]

      if -3.15000000000000004e69 < rand < 6.5000000000000003e83

      1. Initial program 99.9%

        \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
        2. frac-2negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
        3. *-lft-identityN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
        4. distribute-frac-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
        5. neg-lowering-neg.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
        6. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
        8. sqrt-prodN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
        10. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        12. sqrt-lowering-sqrt.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        13. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        14. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        16. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        17. metadata-eval100.0%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
      4. Applied egg-rr100.0%

        \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
      5. Taylor expanded in rand around 0

        \[\leadsto \color{blue}{a - \frac{1}{3}} \]
      6. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto a + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)} \]
        2. metadata-evalN/A

          \[\leadsto a + \frac{-1}{3} \]
        3. +-lowering-+.f6495.4%

          \[\leadsto \mathsf{+.f64}\left(a, \color{blue}{\frac{-1}{3}}\right) \]
      7. Simplified95.4%

        \[\leadsto \color{blue}{a + -0.3333333333333333} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 6: 99.8% accurate, 2.4× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(\sqrt{a + -0.3333333333333333}, rand \cdot 0.3333333333333333, a + -0.3333333333333333\right) \end{array} \]
    (FPCore (a rand)
     :precision binary64
     (fma
      (sqrt (+ a -0.3333333333333333))
      (* rand 0.3333333333333333)
      (+ a -0.3333333333333333)))
    double code(double a, double rand) {
    	return fma(sqrt((a + -0.3333333333333333)), (rand * 0.3333333333333333), (a + -0.3333333333333333));
    }
    
    function code(a, rand)
    	return fma(sqrt(Float64(a + -0.3333333333333333)), Float64(rand * 0.3333333333333333), Float64(a + -0.3333333333333333))
    end
    
    code[a_, rand_] := N[(N[Sqrt[N[(a + -0.3333333333333333), $MachinePrecision]], $MachinePrecision] * N[(rand * 0.3333333333333333), $MachinePrecision] + N[(a + -0.3333333333333333), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(\sqrt{a + -0.3333333333333333}, rand \cdot 0.3333333333333333, a + -0.3333333333333333\right)
    \end{array}
    
    Derivation
    1. Initial program 99.8%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
      2. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
      3. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
      4. distribute-frac-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-eval99.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
    5. Taylor expanded in rand around 0

      \[\leadsto \color{blue}{\left(a + \frac{1}{3} \cdot \left(rand \cdot \sqrt{a - \frac{1}{3}}\right)\right) - \frac{1}{3}} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \left(\frac{1}{3} \cdot \left(rand \cdot \sqrt{a - \frac{1}{3}}\right) + a\right) - \frac{1}{3} \]
      2. associate--l+N/A

        \[\leadsto \frac{1}{3} \cdot \left(rand \cdot \sqrt{a - \frac{1}{3}}\right) + \color{blue}{\left(a - \frac{1}{3}\right)} \]
      3. *-commutativeN/A

        \[\leadsto \left(rand \cdot \sqrt{a - \frac{1}{3}}\right) \cdot \frac{1}{3} + \left(\color{blue}{a} - \frac{1}{3}\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\sqrt{a - \frac{1}{3}} \cdot rand\right) \cdot \frac{1}{3} + \left(a - \frac{1}{3}\right) \]
      5. associate-*l*N/A

        \[\leadsto \sqrt{a - \frac{1}{3}} \cdot \left(rand \cdot \frac{1}{3}\right) + \left(\color{blue}{a} - \frac{1}{3}\right) \]
      6. *-commutativeN/A

        \[\leadsto \sqrt{a - \frac{1}{3}} \cdot \left(\frac{1}{3} \cdot rand\right) + \left(a - \frac{1}{3}\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \color{blue}{\left(\frac{1}{3} \cdot rand\right)}, \left(a - \frac{1}{3}\right)\right) \]
      8. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\color{blue}{\frac{1}{3}} \cdot rand\right), \left(a - \frac{1}{3}\right)\right) \]
      9. sub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\frac{1}{3} \cdot rand\right), \left(a - \frac{1}{3}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \frac{-1}{3}\right)\right), \left(\frac{1}{3} \cdot rand\right), \left(a - \frac{1}{3}\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\frac{1}{3} \cdot rand\right), \left(a - \frac{1}{3}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \mathsf{*.f64}\left(\frac{1}{3}, \color{blue}{rand}\right), \left(a - \frac{1}{3}\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \mathsf{*.f64}\left(\frac{1}{3}, rand\right), \left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \mathsf{*.f64}\left(\frac{1}{3}, rand\right), \left(a + \frac{-1}{3}\right)\right) \]
      15. +-lowering-+.f6499.9%

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \mathsf{*.f64}\left(\frac{1}{3}, rand\right), \mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right) \]
    7. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{a + -0.3333333333333333}, 0.3333333333333333 \cdot rand, a + -0.3333333333333333\right)} \]
    8. Final simplification99.9%

      \[\leadsto \mathsf{fma}\left(\sqrt{a + -0.3333333333333333}, rand \cdot 0.3333333333333333, a + -0.3333333333333333\right) \]
    9. Add Preprocessing

    Alternative 7: 97.4% accurate, 3.1× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(rand \cdot 0.3333333333333333, \sqrt{a}, a\right) \end{array} \]
    (FPCore (a rand)
     :precision binary64
     (fma (* rand 0.3333333333333333) (sqrt a) a))
    double code(double a, double rand) {
    	return fma((rand * 0.3333333333333333), sqrt(a), a);
    }
    
    function code(a, rand)
    	return fma(Float64(rand * 0.3333333333333333), sqrt(a), a)
    end
    
    code[a_, rand_] := N[(N[(rand * 0.3333333333333333), $MachinePrecision] * N[Sqrt[a], $MachinePrecision] + a), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(rand \cdot 0.3333333333333333, \sqrt{a}, a\right)
    \end{array}
    
    Derivation
    1. Initial program 99.8%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
      2. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
      3. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
      4. distribute-frac-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-eval99.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
    5. Taylor expanded in a around inf

      \[\leadsto \color{blue}{a \cdot \left(1 - \frac{-1}{3} \cdot \left(\sqrt{\frac{1}{a}} \cdot rand\right)\right)} \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{\left(1 - \frac{-1}{3} \cdot \left(\sqrt{\frac{1}{a}} \cdot rand\right)\right)}\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f64}\left(a, \left(1 + \color{blue}{\left(\mathsf{neg}\left(\frac{-1}{3}\right)\right) \cdot \left(\sqrt{\frac{1}{a}} \cdot rand\right)}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(a, \left(1 + \frac{1}{3} \cdot \left(\color{blue}{\sqrt{\frac{1}{a}}} \cdot rand\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(a, \left(\frac{1}{3} \cdot \left(\sqrt{\frac{1}{a}} \cdot rand\right) + \color{blue}{1}\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(a, \left(\left(\sqrt{\frac{1}{a}} \cdot rand\right) \cdot \frac{1}{3} + 1\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(a, \left(\sqrt{\frac{1}{a}} \cdot \left(rand \cdot \frac{1}{3}\right) + 1\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(a, \left(\sqrt{\frac{1}{a}} \cdot \left(\frac{1}{3} \cdot rand\right) + 1\right)\right) \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{*.f64}\left(a, \mathsf{fma.f64}\left(\left(\sqrt{\frac{1}{a}}\right), \color{blue}{\left(\frac{1}{3} \cdot rand\right)}, 1\right)\right) \]
      9. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(a, \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{1}{a}\right)\right), \left(\color{blue}{\frac{1}{3}} \cdot rand\right), 1\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(a, \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, a\right)\right), \left(\frac{1}{3} \cdot rand\right), 1\right)\right) \]
      11. *-lowering-*.f6497.7%

        \[\leadsto \mathsf{*.f64}\left(a, \mathsf{fma.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, a\right)\right), \mathsf{*.f64}\left(\frac{1}{3}, \color{blue}{rand}\right), 1\right)\right) \]
    7. Simplified97.7%

      \[\leadsto \color{blue}{a \cdot \mathsf{fma}\left(\sqrt{\frac{1}{a}}, 0.3333333333333333 \cdot rand, 1\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \left(\sqrt{\frac{1}{a}} \cdot \left(\frac{1}{3} \cdot rand\right)\right) \cdot a + \color{blue}{1 \cdot a} \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\frac{1}{3} \cdot rand\right) \cdot \sqrt{\frac{1}{a}}\right) \cdot a + 1 \cdot a \]
      3. associate-*l*N/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot \left(\sqrt{\frac{1}{a}} \cdot a\right) + \color{blue}{1} \cdot a \]
      4. pow1/2N/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot \left({\left(\frac{1}{a}\right)}^{\frac{1}{2}} \cdot a\right) + 1 \cdot a \]
      5. inv-powN/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot \left({\left({a}^{-1}\right)}^{\frac{1}{2}} \cdot a\right) + 1 \cdot a \]
      6. pow-powN/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot \left({a}^{\left(-1 \cdot \frac{1}{2}\right)} \cdot a\right) + 1 \cdot a \]
      7. pow-plusN/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot {a}^{\left(-1 \cdot \frac{1}{2} + 1\right)} + 1 \cdot a \]
      8. metadata-evalN/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot {a}^{\left(\frac{-1}{2} + 1\right)} + 1 \cdot a \]
      9. metadata-evalN/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot {a}^{\frac{1}{2}} + 1 \cdot a \]
      10. pow1/2N/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot \sqrt{a} + 1 \cdot a \]
      11. *-lft-identityN/A

        \[\leadsto \left(\frac{1}{3} \cdot rand\right) \cdot \sqrt{a} + a \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma.f64}\left(\left(\frac{1}{3} \cdot rand\right), \color{blue}{\left(\sqrt{a}\right)}, a\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(\left(rand \cdot \frac{1}{3}\right), \left(\sqrt{\color{blue}{a}}\right), a\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{*.f64}\left(rand, \frac{1}{3}\right), \left(\sqrt{\color{blue}{a}}\right), a\right) \]
      15. sqrt-lowering-sqrt.f6497.7%

        \[\leadsto \mathsf{fma.f64}\left(\mathsf{*.f64}\left(rand, \frac{1}{3}\right), \mathsf{sqrt.f64}\left(a\right), a\right) \]
    9. Applied egg-rr97.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(rand \cdot 0.3333333333333333, \sqrt{a}, a\right)} \]
    10. Add Preprocessing

    Alternative 8: 63.7% accurate, 17.0× speedup?

    \[\begin{array}{l} \\ a + -0.3333333333333333 \end{array} \]
    (FPCore (a rand) :precision binary64 (+ a -0.3333333333333333))
    double code(double a, double rand) {
    	return a + -0.3333333333333333;
    }
    
    real(8) function code(a, rand)
        real(8), intent (in) :: a
        real(8), intent (in) :: rand
        code = a + (-0.3333333333333333d0)
    end function
    
    public static double code(double a, double rand) {
    	return a + -0.3333333333333333;
    }
    
    def code(a, rand):
    	return a + -0.3333333333333333
    
    function code(a, rand)
    	return Float64(a + -0.3333333333333333)
    end
    
    function tmp = code(a, rand)
    	tmp = a + -0.3333333333333333;
    end
    
    code[a_, rand_] := N[(a + -0.3333333333333333), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    a + -0.3333333333333333
    \end{array}
    
    Derivation
    1. Initial program 99.8%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
      2. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
      3. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
      4. distribute-frac-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-eval99.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
    5. Taylor expanded in rand around 0

      \[\leadsto \color{blue}{a - \frac{1}{3}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto a + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto a + \frac{-1}{3} \]
      3. +-lowering-+.f6466.3%

        \[\leadsto \mathsf{+.f64}\left(a, \color{blue}{\frac{-1}{3}}\right) \]
    7. Simplified66.3%

      \[\leadsto \color{blue}{a + -0.3333333333333333} \]
    8. Add Preprocessing

    Alternative 9: 62.4% accurate, 68.0× speedup?

    \[\begin{array}{l} \\ a \end{array} \]
    (FPCore (a rand) :precision binary64 a)
    double code(double a, double rand) {
    	return a;
    }
    
    real(8) function code(a, rand)
        real(8), intent (in) :: a
        real(8), intent (in) :: rand
        code = a
    end function
    
    public static double code(double a, double rand) {
    	return a;
    }
    
    def code(a, rand):
    	return a
    
    function code(a, rand)
    	return a
    end
    
    function tmp = code(a, rand)
    	tmp = a;
    end
    
    code[a_, rand_] := a
    
    \begin{array}{l}
    
    \\
    a
    \end{array}
    
    Derivation
    1. Initial program 99.8%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
      2. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
      3. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
      4. distribute-frac-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
      17. metadata-eval99.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

      \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
    5. Taylor expanded in rand around 0

      \[\leadsto \color{blue}{a - \frac{1}{3}} \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto a + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto a + \frac{-1}{3} \]
      3. +-lowering-+.f6466.3%

        \[\leadsto \mathsf{+.f64}\left(a, \color{blue}{\frac{-1}{3}}\right) \]
    7. Simplified66.3%

      \[\leadsto \color{blue}{a + -0.3333333333333333} \]
    8. Taylor expanded in a around inf

      \[\leadsto \color{blue}{a} \]
    9. Step-by-step derivation
      1. Simplified65.4%

        \[\leadsto \color{blue}{a} \]
      2. Add Preprocessing

      Alternative 10: 1.5% accurate, 68.0× speedup?

      \[\begin{array}{l} \\ -0.3333333333333333 \end{array} \]
      (FPCore (a rand) :precision binary64 -0.3333333333333333)
      double code(double a, double rand) {
      	return -0.3333333333333333;
      }
      
      real(8) function code(a, rand)
          real(8), intent (in) :: a
          real(8), intent (in) :: rand
          code = -0.3333333333333333d0
      end function
      
      public static double code(double a, double rand) {
      	return -0.3333333333333333;
      }
      
      def code(a, rand):
      	return -0.3333333333333333
      
      function code(a, rand)
      	return -0.3333333333333333
      end
      
      function tmp = code(a, rand)
      	tmp = -0.3333333333333333;
      end
      
      code[a_, rand_] := -0.3333333333333333
      
      \begin{array}{l}
      
      \\
      -0.3333333333333333
      \end{array}
      
      Derivation
      1. Initial program 99.8%

        \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{1 \cdot rand}{\color{blue}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right)\right)\right) \]
        2. frac-2negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(1 \cdot rand\right)}{\color{blue}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}}\right)\right)\right) \]
        3. *-lft-identityN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\frac{\mathsf{neg}\left(rand\right)}{\mathsf{neg}\left(\sqrt{\color{blue}{9 \cdot \left(a - \frac{1}{3}\right)}}\right)}\right)\right)\right) \]
        4. distribute-frac-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
        5. neg-lowering-neg.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\left(\frac{rand}{\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)}\right)\right)\right)\right) \]
        6. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}\right)\right)\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{\left(a - \frac{1}{3}\right) \cdot 9}\right)\right)\right)\right)\right)\right) \]
        8. sqrt-prodN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot \sqrt{9}\right)\right)\right)\right)\right)\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\mathsf{neg}\left(\sqrt{a - \frac{1}{3}} \cdot 3\right)\right)\right)\right)\right)\right) \]
        10. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \left(\sqrt{a - \frac{1}{3}} \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\left(\sqrt{a - \frac{1}{3}}\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        12. sqrt-lowering-sqrt.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a - \frac{1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        13. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(a + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        14. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        16. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right)\right) \]
        17. metadata-eval99.9%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(a, \mathsf{/.f64}\left(1, 3\right)\right), \mathsf{+.f64}\left(1, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(rand, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(a, \frac{-1}{3}\right)\right), -3\right)\right)\right)\right)\right) \]
      4. Applied egg-rr99.9%

        \[\leadsto \left(a - \frac{1}{3}\right) \cdot \left(1 + \color{blue}{\left(-\frac{rand}{\sqrt{a + -0.3333333333333333} \cdot -3}\right)}\right) \]
      5. Taylor expanded in rand around 0

        \[\leadsto \color{blue}{a - \frac{1}{3}} \]
      6. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto a + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)} \]
        2. metadata-evalN/A

          \[\leadsto a + \frac{-1}{3} \]
        3. +-lowering-+.f6466.3%

          \[\leadsto \mathsf{+.f64}\left(a, \color{blue}{\frac{-1}{3}}\right) \]
      7. Simplified66.3%

        \[\leadsto \color{blue}{a + -0.3333333333333333} \]
      8. Taylor expanded in a around 0

        \[\leadsto \color{blue}{\frac{-1}{3}} \]
      9. Step-by-step derivation
        1. Simplified1.6%

          \[\leadsto \color{blue}{-0.3333333333333333} \]
        2. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2024193 
        (FPCore (a rand)
          :name "Octave 3.8, oct_fill_randg"
          :precision binary64
          (* (- a (/ 1.0 3.0)) (+ 1.0 (* (/ 1.0 (sqrt (* 9.0 (- a (/ 1.0 3.0))))) rand))))