Octave 3.8, oct_fill_randg

Percentage Accurate: 99.7% → 99.7%
Time: 11.3s
Alternatives: 10
Speedup: 1.1×

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.7% accurate, 0.6× 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. Step-by-step derivation
    1. remove-double-neg99.8%

      \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. remove-double-neg99.8%

      \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    3. sub-neg99.8%

      \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    4. metadata-eval99.8%

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

      \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    6. remove-double-neg99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
    7. remove-double-neg99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
    8. associate-*l/99.9%

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

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
    11. distribute-lft-in99.9%

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

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{\mathsf{fma}\left(a, 9, 9 \cdot \left(-\frac{1}{3}\right)\right)}}}\right) \]
    14. metadata-eval99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\mathsf{fma}\left(a, 9, 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)\right)}}\right) \]
    15. metadata-eval99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\mathsf{fma}\left(a, 9, 9 \cdot \color{blue}{-0.3333333333333333}\right)}}\right) \]
    16. metadata-eval99.9%

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

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

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

Alternative 2: 99.8% accurate, 1.1× speedup?

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

\\
\left(a + -0.3333333333333333\right) \cdot \left(1 + rand \cdot \sqrt{\frac{0.1111111111111111}{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. Step-by-step derivation
    1. sub-neg99.8%

      \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. metadata-eval99.8%

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

      \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    4. *-commutative99.8%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{1}{\sqrt{\color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot 9}} \cdot rand\right) \]
    6. metadata-eval99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{1}{\sqrt{\left(a + \left(-\color{blue}{0.3333333333333333}\right)\right) \cdot 9}} \cdot rand\right) \]
    7. metadata-eval99.8%

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

    \[\leadsto \color{blue}{\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand\right)} \]
  4. Step-by-step derivation
    1. add-sqr-sqrt99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(\sqrt{\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}} \cdot \sqrt{\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}\right)} \cdot rand\right) \]
    2. sqrt-unprod99.8%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9} \cdot \sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}} \cdot rand\right) \]
    4. metadata-eval99.9%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{1}{\color{blue}{\left(a + -0.3333333333333333\right) \cdot 9}}} \cdot rand\right) \]
    6. *-commutative99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}} \cdot rand\right) \]
    7. distribute-rgt-in99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{1}{\color{blue}{a \cdot 9 + -0.3333333333333333 \cdot 9}}} \cdot rand\right) \]
    8. metadata-eval99.9%

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

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

    \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\sqrt{\frac{1}{\mathsf{fma}\left(a, 9, -3\right)}}} \cdot rand\right) \]
  6. Step-by-step derivation
    1. fma-def99.9%

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

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}} \cdot rand\right) \]
    4. associate-/r*99.9%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{\color{blue}{0.1111111111111111}}{a + -0.3333333333333333}} \cdot rand\right) \]
  7. Simplified99.9%

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

    \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + rand \cdot \sqrt{\frac{0.1111111111111111}{a + -0.3333333333333333}}\right) \]

Alternative 3: 92.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;rand \leq -3.8 \cdot 10^{+80} \lor \neg \left(rand \leq 7.2 \cdot 10^{+61}\right):\\ \;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a - 0.3333333333333333}\right)\\ \mathbf{else}:\\ \;\;\;\;a - 0.3333333333333333\\ \end{array} \end{array} \]
(FPCore (a rand)
 :precision binary64
 (if (or (<= rand -3.8e+80) (not (<= rand 7.2e+61)))
   (* 0.3333333333333333 (* rand (sqrt (- a 0.3333333333333333))))
   (- a 0.3333333333333333)))
double code(double a, double rand) {
	double tmp;
	if ((rand <= -3.8e+80) || !(rand <= 7.2e+61)) {
		tmp = 0.3333333333333333 * (rand * sqrt((a - 0.3333333333333333)));
	} else {
		tmp = a - 0.3333333333333333;
	}
	return tmp;
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    real(8) :: tmp
    if ((rand <= (-3.8d+80)) .or. (.not. (rand <= 7.2d+61))) then
        tmp = 0.3333333333333333d0 * (rand * sqrt((a - 0.3333333333333333d0)))
    else
        tmp = a - 0.3333333333333333d0
    end if
    code = tmp
end function
public static double code(double a, double rand) {
	double tmp;
	if ((rand <= -3.8e+80) || !(rand <= 7.2e+61)) {
		tmp = 0.3333333333333333 * (rand * Math.sqrt((a - 0.3333333333333333)));
	} else {
		tmp = a - 0.3333333333333333;
	}
	return tmp;
}
def code(a, rand):
	tmp = 0
	if (rand <= -3.8e+80) or not (rand <= 7.2e+61):
		tmp = 0.3333333333333333 * (rand * math.sqrt((a - 0.3333333333333333)))
	else:
		tmp = a - 0.3333333333333333
	return tmp
function code(a, rand)
	tmp = 0.0
	if ((rand <= -3.8e+80) || !(rand <= 7.2e+61))
		tmp = Float64(0.3333333333333333 * Float64(rand * sqrt(Float64(a - 0.3333333333333333))));
	else
		tmp = Float64(a - 0.3333333333333333);
	end
	return tmp
end
function tmp_2 = code(a, rand)
	tmp = 0.0;
	if ((rand <= -3.8e+80) || ~((rand <= 7.2e+61)))
		tmp = 0.3333333333333333 * (rand * sqrt((a - 0.3333333333333333)));
	else
		tmp = a - 0.3333333333333333;
	end
	tmp_2 = tmp;
end
code[a_, rand_] := If[Or[LessEqual[rand, -3.8e+80], N[Not[LessEqual[rand, 7.2e+61]], $MachinePrecision]], N[(0.3333333333333333 * N[(rand * N[Sqrt[N[(a - 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a - 0.3333333333333333), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;rand \leq -3.8 \cdot 10^{+80} \lor \neg \left(rand \leq 7.2 \cdot 10^{+61}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a - 0.3333333333333333}\right)\\

\mathbf{else}:\\
\;\;\;\;a - 0.3333333333333333\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if rand < -3.79999999999999997e80 or 7.20000000000000021e61 < rand

    1. Initial program 99.7%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Step-by-step derivation
      1. remove-double-neg99.7%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg99.7%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg99.7%

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

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval99.7%

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

      \[\leadsto \color{blue}{\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + -3}}\right)} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt52.4%

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

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

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\color{blue}{\frac{rand \cdot rand}{\sqrt{9 \cdot a + -3} \cdot \sqrt{9 \cdot a + -3}}}}\right) \]
      4. add-sqr-sqrt39.7%

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

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{rand \cdot rand}{9 \cdot a + \color{blue}{9 \cdot -0.3333333333333333}}}\right) \]
      6. distribute-lft-in39.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{rand \cdot rand}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}}\right) \]
      7. *-commutative39.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{rand \cdot rand}{\color{blue}{\left(a + -0.3333333333333333\right) \cdot 9}}}\right) \]
      8. add-sqr-sqrt39.7%

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

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\color{blue}{\frac{rand}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot \frac{rand}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}}\right) \]
      10. *-un-lft-identity49.5%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{\color{blue}{1 \cdot rand}}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot \frac{rand}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}\right) \]
      11. associate-*l/49.5%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\color{blue}{\left(\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand\right)} \cdot \frac{rand}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}\right) \]
      12. *-un-lft-identity49.5%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\left(\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand\right) \cdot \frac{\color{blue}{1 \cdot rand}}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}\right) \]
      13. associate-*l/49.5%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\left(\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand\right) \cdot \color{blue}{\left(\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand\right)}}\right) \]
      14. sqrt-unprod52.4%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\sqrt{\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand} \cdot \sqrt{\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand}}\right) \]
      15. add-sqr-sqrt99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand}\right) \]
      16. associate-*l/99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}\right) \]
      17. sqrt-prod99.6%

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

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

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

    if -3.79999999999999997e80 < rand < 7.20000000000000021e61

    1. Initial program 100.0%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg100.0%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg100.0%

        \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      4. metadata-eval100.0%

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;rand \leq -3.8 \cdot 10^{+80} \lor \neg \left(rand \leq 7.2 \cdot 10^{+61}\right):\\ \;\;\;\;0.3333333333333333 \cdot \left(rand \cdot \sqrt{a - 0.3333333333333333}\right)\\ \mathbf{else}:\\ \;\;\;\;a - 0.3333333333333333\\ \end{array} \]

Alternative 4: 92.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;rand \leq -5.9 \cdot 10^{+69} \lor \neg \left(rand \leq 5.2 \cdot 10^{+66}\right):\\ \;\;\;\;rand \cdot \sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}\\ \mathbf{else}:\\ \;\;\;\;a - 0.3333333333333333\\ \end{array} \end{array} \]
(FPCore (a rand)
 :precision binary64
 (if (or (<= rand -5.9e+69) (not (<= rand 5.2e+66)))
   (* rand (sqrt (+ -0.037037037037037035 (* a 0.1111111111111111))))
   (- a 0.3333333333333333)))
double code(double a, double rand) {
	double tmp;
	if ((rand <= -5.9e+69) || !(rand <= 5.2e+66)) {
		tmp = rand * sqrt((-0.037037037037037035 + (a * 0.1111111111111111)));
	} else {
		tmp = a - 0.3333333333333333;
	}
	return tmp;
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    real(8) :: tmp
    if ((rand <= (-5.9d+69)) .or. (.not. (rand <= 5.2d+66))) then
        tmp = rand * sqrt(((-0.037037037037037035d0) + (a * 0.1111111111111111d0)))
    else
        tmp = a - 0.3333333333333333d0
    end if
    code = tmp
end function
public static double code(double a, double rand) {
	double tmp;
	if ((rand <= -5.9e+69) || !(rand <= 5.2e+66)) {
		tmp = rand * Math.sqrt((-0.037037037037037035 + (a * 0.1111111111111111)));
	} else {
		tmp = a - 0.3333333333333333;
	}
	return tmp;
}
def code(a, rand):
	tmp = 0
	if (rand <= -5.9e+69) or not (rand <= 5.2e+66):
		tmp = rand * math.sqrt((-0.037037037037037035 + (a * 0.1111111111111111)))
	else:
		tmp = a - 0.3333333333333333
	return tmp
function code(a, rand)
	tmp = 0.0
	if ((rand <= -5.9e+69) || !(rand <= 5.2e+66))
		tmp = Float64(rand * sqrt(Float64(-0.037037037037037035 + Float64(a * 0.1111111111111111))));
	else
		tmp = Float64(a - 0.3333333333333333);
	end
	return tmp
end
function tmp_2 = code(a, rand)
	tmp = 0.0;
	if ((rand <= -5.9e+69) || ~((rand <= 5.2e+66)))
		tmp = rand * sqrt((-0.037037037037037035 + (a * 0.1111111111111111)));
	else
		tmp = a - 0.3333333333333333;
	end
	tmp_2 = tmp;
end
code[a_, rand_] := If[Or[LessEqual[rand, -5.9e+69], N[Not[LessEqual[rand, 5.2e+66]], $MachinePrecision]], N[(rand * N[Sqrt[N[(-0.037037037037037035 + N[(a * 0.1111111111111111), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(a - 0.3333333333333333), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;rand \leq -5.9 \cdot 10^{+69} \lor \neg \left(rand \leq 5.2 \cdot 10^{+66}\right):\\
\;\;\;\;rand \cdot \sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}\\

\mathbf{else}:\\
\;\;\;\;a - 0.3333333333333333\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if rand < -5.90000000000000004e69 or 5.20000000000000024e66 < rand

    1. Initial program 99.7%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Step-by-step derivation
      1. remove-double-neg99.7%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg99.7%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg99.7%

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

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval99.7%

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

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

      \[\leadsto \color{blue}{\left(\left(a - 0.3333333333333333\right) \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}}} \]
    5. Step-by-step derivation
      1. sub-neg68.7%

        \[\leadsto \left(\color{blue}{\left(a + \left(-0.3333333333333333\right)\right)} \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}} \]
      2. metadata-eval68.7%

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

        \[\leadsto \color{blue}{\left(rand \cdot \left(a + -0.3333333333333333\right)\right)} \cdot \sqrt{\frac{1}{9 \cdot a - 3}} \]
      4. associate-*l*89.6%

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

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

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{-3}}}\right) \]
      7. metadata-eval89.6%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{9 \cdot -0.3333333333333333}}}\right) \]
      8. distribute-lft-in89.6%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}}\right) \]
      9. associate-/r*89.7%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{9}}{a + -0.3333333333333333}}}\right) \]
      10. metadata-eval89.7%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{\color{blue}{0.1111111111111111}}{a + -0.3333333333333333}}\right) \]
    6. Simplified89.7%

      \[\leadsto \color{blue}{rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{0.1111111111111111}{a + -0.3333333333333333}}\right)} \]
    7. Step-by-step derivation
      1. sqrt-div89.5%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \color{blue}{\frac{\sqrt{0.1111111111111111}}{\sqrt{a + -0.3333333333333333}}}\right) \]
      2. metadata-eval89.5%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \frac{\color{blue}{0.3333333333333333}}{\sqrt{a + -0.3333333333333333}}\right) \]
      3. associate-*r/89.5%

        \[\leadsto rand \cdot \color{blue}{\frac{\left(a + -0.3333333333333333\right) \cdot 0.3333333333333333}{\sqrt{a + -0.3333333333333333}}} \]
    8. Applied egg-rr89.5%

      \[\leadsto rand \cdot \color{blue}{\frac{\left(a + -0.3333333333333333\right) \cdot 0.3333333333333333}{\sqrt{a + -0.3333333333333333}}} \]
    9. Step-by-step derivation
      1. associate-/l*89.5%

        \[\leadsto rand \cdot \color{blue}{\frac{a + -0.3333333333333333}{\frac{\sqrt{a + -0.3333333333333333}}{0.3333333333333333}}} \]
      2. add-sqr-sqrt89.5%

        \[\leadsto rand \cdot \frac{\color{blue}{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}}{\frac{\sqrt{a + -0.3333333333333333}}{0.3333333333333333}} \]
      3. +-commutative89.5%

        \[\leadsto rand \cdot \frac{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}{\frac{\sqrt{\color{blue}{-0.3333333333333333 + a}}}{0.3333333333333333}} \]
      4. *-un-lft-identity89.5%

        \[\leadsto rand \cdot \frac{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}{\color{blue}{1 \cdot \frac{\sqrt{-0.3333333333333333 + a}}{0.3333333333333333}}} \]
      5. times-frac89.6%

        \[\leadsto rand \cdot \color{blue}{\left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\frac{\sqrt{-0.3333333333333333 + a}}{0.3333333333333333}}\right)} \]
      6. div-inv89.5%

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

        \[\leadsto rand \cdot \left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{\color{blue}{a + -0.3333333333333333}} \cdot \frac{1}{0.3333333333333333}}\right) \]
      8. metadata-eval89.5%

        \[\leadsto rand \cdot \left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot \color{blue}{3}}\right) \]
    10. Applied egg-rr89.5%

      \[\leadsto rand \cdot \color{blue}{\left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot 3}\right)} \]
    11. Step-by-step derivation
      1. /-rgt-identity89.5%

        \[\leadsto rand \cdot \left(\color{blue}{\sqrt{a + -0.3333333333333333}} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot 3}\right) \]
      2. associate-/r*89.6%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \color{blue}{\frac{\frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333}}}{3}}\right) \]
      3. *-inverses89.6%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \frac{\color{blue}{1}}{3}\right) \]
      4. metadata-eval89.6%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \color{blue}{0.3333333333333333}\right) \]
      5. *-commutative89.6%

        \[\leadsto rand \cdot \color{blue}{\left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)} \]
    12. Simplified89.6%

      \[\leadsto rand \cdot \color{blue}{\left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)} \]
    13. Step-by-step derivation
      1. add-sqr-sqrt89.4%

        \[\leadsto rand \cdot \color{blue}{\left(\sqrt{0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}} \cdot \sqrt{0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}}\right)} \]
      2. sqrt-unprod89.6%

        \[\leadsto rand \cdot \color{blue}{\sqrt{\left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right) \cdot \left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)}} \]
      3. *-commutative89.6%

        \[\leadsto rand \cdot \sqrt{\color{blue}{\left(\sqrt{a + -0.3333333333333333} \cdot 0.3333333333333333\right)} \cdot \left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)} \]
      4. *-commutative89.6%

        \[\leadsto rand \cdot \sqrt{\left(\sqrt{a + -0.3333333333333333} \cdot 0.3333333333333333\right) \cdot \color{blue}{\left(\sqrt{a + -0.3333333333333333} \cdot 0.3333333333333333\right)}} \]
      5. swap-sqr89.6%

        \[\leadsto rand \cdot \sqrt{\color{blue}{\left(\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}\right) \cdot \left(0.3333333333333333 \cdot 0.3333333333333333\right)}} \]
      6. add-sqr-sqrt89.7%

        \[\leadsto rand \cdot \sqrt{\color{blue}{\left(a + -0.3333333333333333\right)} \cdot \left(0.3333333333333333 \cdot 0.3333333333333333\right)} \]
      7. metadata-eval89.7%

        \[\leadsto rand \cdot \sqrt{\left(a + -0.3333333333333333\right) \cdot \color{blue}{0.1111111111111111}} \]
    14. Applied egg-rr89.7%

      \[\leadsto rand \cdot \color{blue}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 0.1111111111111111}} \]
    15. Step-by-step derivation
      1. *-commutative89.7%

        \[\leadsto rand \cdot \sqrt{\color{blue}{0.1111111111111111 \cdot \left(a + -0.3333333333333333\right)}} \]
      2. +-commutative89.7%

        \[\leadsto rand \cdot \sqrt{0.1111111111111111 \cdot \color{blue}{\left(-0.3333333333333333 + a\right)}} \]
      3. distribute-rgt-in89.7%

        \[\leadsto rand \cdot \sqrt{\color{blue}{-0.3333333333333333 \cdot 0.1111111111111111 + a \cdot 0.1111111111111111}} \]
      4. metadata-eval89.7%

        \[\leadsto rand \cdot \sqrt{\color{blue}{-0.037037037037037035} + a \cdot 0.1111111111111111} \]
    16. Simplified89.7%

      \[\leadsto rand \cdot \color{blue}{\sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}} \]

    if -5.90000000000000004e69 < rand < 5.20000000000000024e66

    1. Initial program 100.0%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg100.0%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg100.0%

        \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      4. metadata-eval100.0%

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;rand \leq -5.9 \cdot 10^{+69} \lor \neg \left(rand \leq 5.2 \cdot 10^{+66}\right):\\ \;\;\;\;rand \cdot \sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}\\ \mathbf{else}:\\ \;\;\;\;a - 0.3333333333333333\\ \end{array} \]

Alternative 5: 92.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;rand \leq -1 \cdot 10^{+80} \lor \neg \left(rand \leq 7.2 \cdot 10^{+61}\right):\\ \;\;\;\;\frac{rand \cdot \sqrt{a + -0.3333333333333333}}{3}\\ \mathbf{else}:\\ \;\;\;\;a - 0.3333333333333333\\ \end{array} \end{array} \]
(FPCore (a rand)
 :precision binary64
 (if (or (<= rand -1e+80) (not (<= rand 7.2e+61)))
   (/ (* rand (sqrt (+ a -0.3333333333333333))) 3.0)
   (- a 0.3333333333333333)))
double code(double a, double rand) {
	double tmp;
	if ((rand <= -1e+80) || !(rand <= 7.2e+61)) {
		tmp = (rand * sqrt((a + -0.3333333333333333))) / 3.0;
	} else {
		tmp = a - 0.3333333333333333;
	}
	return tmp;
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    real(8) :: tmp
    if ((rand <= (-1d+80)) .or. (.not. (rand <= 7.2d+61))) then
        tmp = (rand * sqrt((a + (-0.3333333333333333d0)))) / 3.0d0
    else
        tmp = a - 0.3333333333333333d0
    end if
    code = tmp
end function
public static double code(double a, double rand) {
	double tmp;
	if ((rand <= -1e+80) || !(rand <= 7.2e+61)) {
		tmp = (rand * Math.sqrt((a + -0.3333333333333333))) / 3.0;
	} else {
		tmp = a - 0.3333333333333333;
	}
	return tmp;
}
def code(a, rand):
	tmp = 0
	if (rand <= -1e+80) or not (rand <= 7.2e+61):
		tmp = (rand * math.sqrt((a + -0.3333333333333333))) / 3.0
	else:
		tmp = a - 0.3333333333333333
	return tmp
function code(a, rand)
	tmp = 0.0
	if ((rand <= -1e+80) || !(rand <= 7.2e+61))
		tmp = Float64(Float64(rand * sqrt(Float64(a + -0.3333333333333333))) / 3.0);
	else
		tmp = Float64(a - 0.3333333333333333);
	end
	return tmp
end
function tmp_2 = code(a, rand)
	tmp = 0.0;
	if ((rand <= -1e+80) || ~((rand <= 7.2e+61)))
		tmp = (rand * sqrt((a + -0.3333333333333333))) / 3.0;
	else
		tmp = a - 0.3333333333333333;
	end
	tmp_2 = tmp;
end
code[a_, rand_] := If[Or[LessEqual[rand, -1e+80], N[Not[LessEqual[rand, 7.2e+61]], $MachinePrecision]], N[(N[(rand * N[Sqrt[N[(a + -0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision], N[(a - 0.3333333333333333), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;rand \leq -1 \cdot 10^{+80} \lor \neg \left(rand \leq 7.2 \cdot 10^{+61}\right):\\
\;\;\;\;\frac{rand \cdot \sqrt{a + -0.3333333333333333}}{3}\\

\mathbf{else}:\\
\;\;\;\;a - 0.3333333333333333\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if rand < -1e80 or 7.20000000000000021e61 < rand

    1. Initial program 99.7%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Step-by-step derivation
      1. remove-double-neg99.7%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg99.7%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg99.7%

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

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval99.7%

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

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

      \[\leadsto \color{blue}{\left(\left(a - 0.3333333333333333\right) \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}}} \]
    5. Step-by-step derivation
      1. sub-neg68.4%

        \[\leadsto \left(\color{blue}{\left(a + \left(-0.3333333333333333\right)\right)} \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}} \]
      2. metadata-eval68.4%

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

        \[\leadsto \color{blue}{\left(rand \cdot \left(a + -0.3333333333333333\right)\right)} \cdot \sqrt{\frac{1}{9 \cdot a - 3}} \]
      4. associate-*l*89.0%

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

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{\color{blue}{9 \cdot a + \left(-3\right)}}}\right) \]
      6. metadata-eval89.0%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{-3}}}\right) \]
      7. metadata-eval89.0%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{9 \cdot -0.3333333333333333}}}\right) \]
      8. distribute-lft-in89.0%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}}\right) \]
      9. associate-/r*89.1%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{9}}{a + -0.3333333333333333}}}\right) \]
      10. metadata-eval89.1%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{\color{blue}{0.1111111111111111}}{a + -0.3333333333333333}}\right) \]
    6. Simplified89.1%

      \[\leadsto \color{blue}{rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{0.1111111111111111}{a + -0.3333333333333333}}\right)} \]
    7. Step-by-step derivation
      1. sqrt-div88.9%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \color{blue}{\frac{\sqrt{0.1111111111111111}}{\sqrt{a + -0.3333333333333333}}}\right) \]
      2. metadata-eval88.9%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \frac{\color{blue}{0.3333333333333333}}{\sqrt{a + -0.3333333333333333}}\right) \]
      3. associate-*r/88.9%

        \[\leadsto rand \cdot \color{blue}{\frac{\left(a + -0.3333333333333333\right) \cdot 0.3333333333333333}{\sqrt{a + -0.3333333333333333}}} \]
    8. Applied egg-rr88.9%

      \[\leadsto rand \cdot \color{blue}{\frac{\left(a + -0.3333333333333333\right) \cdot 0.3333333333333333}{\sqrt{a + -0.3333333333333333}}} \]
    9. Step-by-step derivation
      1. associate-/l*88.9%

        \[\leadsto rand \cdot \color{blue}{\frac{a + -0.3333333333333333}{\frac{\sqrt{a + -0.3333333333333333}}{0.3333333333333333}}} \]
      2. add-sqr-sqrt88.9%

        \[\leadsto rand \cdot \frac{\color{blue}{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}}{\frac{\sqrt{a + -0.3333333333333333}}{0.3333333333333333}} \]
      3. +-commutative88.9%

        \[\leadsto rand \cdot \frac{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}{\frac{\sqrt{\color{blue}{-0.3333333333333333 + a}}}{0.3333333333333333}} \]
      4. *-un-lft-identity88.9%

        \[\leadsto rand \cdot \frac{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}{\color{blue}{1 \cdot \frac{\sqrt{-0.3333333333333333 + a}}{0.3333333333333333}}} \]
      5. times-frac88.9%

        \[\leadsto rand \cdot \color{blue}{\left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\frac{\sqrt{-0.3333333333333333 + a}}{0.3333333333333333}}\right)} \]
      6. div-inv88.9%

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

        \[\leadsto rand \cdot \left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{\color{blue}{a + -0.3333333333333333}} \cdot \frac{1}{0.3333333333333333}}\right) \]
      8. metadata-eval88.9%

        \[\leadsto rand \cdot \left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot \color{blue}{3}}\right) \]
    10. Applied egg-rr88.9%

      \[\leadsto rand \cdot \color{blue}{\left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot 3}\right)} \]
    11. Step-by-step derivation
      1. /-rgt-identity88.9%

        \[\leadsto rand \cdot \left(\color{blue}{\sqrt{a + -0.3333333333333333}} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot 3}\right) \]
      2. associate-/r*89.0%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \color{blue}{\frac{\frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333}}}{3}}\right) \]
      3. *-inverses89.0%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \frac{\color{blue}{1}}{3}\right) \]
      4. metadata-eval89.0%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \color{blue}{0.3333333333333333}\right) \]
      5. *-commutative89.0%

        \[\leadsto rand \cdot \color{blue}{\left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)} \]
    12. Simplified89.0%

      \[\leadsto rand \cdot \color{blue}{\left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)} \]
    13. Step-by-step derivation
      1. *-commutative89.0%

        \[\leadsto rand \cdot \color{blue}{\left(\sqrt{a + -0.3333333333333333} \cdot 0.3333333333333333\right)} \]
      2. metadata-eval89.0%

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

        \[\leadsto rand \cdot \color{blue}{\frac{\sqrt{a + -0.3333333333333333}}{3}} \]
      4. associate-*r/89.1%

        \[\leadsto \color{blue}{\frac{rand \cdot \sqrt{a + -0.3333333333333333}}{3}} \]
    14. Applied egg-rr89.1%

      \[\leadsto \color{blue}{\frac{rand \cdot \sqrt{a + -0.3333333333333333}}{3}} \]

    if -1e80 < rand < 7.20000000000000021e61

    1. Initial program 100.0%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg100.0%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg100.0%

        \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      4. metadata-eval100.0%

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;rand \leq -1 \cdot 10^{+80} \lor \neg \left(rand \leq 7.2 \cdot 10^{+61}\right):\\ \;\;\;\;\frac{rand \cdot \sqrt{a + -0.3333333333333333}}{3}\\ \mathbf{else}:\\ \;\;\;\;a - 0.3333333333333333\\ \end{array} \]

Alternative 6: 92.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;rand \leq -3.5 \cdot 10^{+79}:\\ \;\;\;\;rand \cdot \sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}\\ \mathbf{elif}\;rand \leq 7.2 \cdot 10^{+61}:\\ \;\;\;\;a - 0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;rand \cdot \frac{\sqrt{a + -0.3333333333333333}}{3}\\ \end{array} \end{array} \]
(FPCore (a rand)
 :precision binary64
 (if (<= rand -3.5e+79)
   (* rand (sqrt (+ -0.037037037037037035 (* a 0.1111111111111111))))
   (if (<= rand 7.2e+61)
     (- a 0.3333333333333333)
     (* rand (/ (sqrt (+ a -0.3333333333333333)) 3.0)))))
double code(double a, double rand) {
	double tmp;
	if (rand <= -3.5e+79) {
		tmp = rand * sqrt((-0.037037037037037035 + (a * 0.1111111111111111)));
	} else if (rand <= 7.2e+61) {
		tmp = a - 0.3333333333333333;
	} else {
		tmp = rand * (sqrt((a + -0.3333333333333333)) / 3.0);
	}
	return tmp;
}
real(8) function code(a, rand)
    real(8), intent (in) :: a
    real(8), intent (in) :: rand
    real(8) :: tmp
    if (rand <= (-3.5d+79)) then
        tmp = rand * sqrt(((-0.037037037037037035d0) + (a * 0.1111111111111111d0)))
    else if (rand <= 7.2d+61) then
        tmp = a - 0.3333333333333333d0
    else
        tmp = rand * (sqrt((a + (-0.3333333333333333d0))) / 3.0d0)
    end if
    code = tmp
end function
public static double code(double a, double rand) {
	double tmp;
	if (rand <= -3.5e+79) {
		tmp = rand * Math.sqrt((-0.037037037037037035 + (a * 0.1111111111111111)));
	} else if (rand <= 7.2e+61) {
		tmp = a - 0.3333333333333333;
	} else {
		tmp = rand * (Math.sqrt((a + -0.3333333333333333)) / 3.0);
	}
	return tmp;
}
def code(a, rand):
	tmp = 0
	if rand <= -3.5e+79:
		tmp = rand * math.sqrt((-0.037037037037037035 + (a * 0.1111111111111111)))
	elif rand <= 7.2e+61:
		tmp = a - 0.3333333333333333
	else:
		tmp = rand * (math.sqrt((a + -0.3333333333333333)) / 3.0)
	return tmp
function code(a, rand)
	tmp = 0.0
	if (rand <= -3.5e+79)
		tmp = Float64(rand * sqrt(Float64(-0.037037037037037035 + Float64(a * 0.1111111111111111))));
	elseif (rand <= 7.2e+61)
		tmp = Float64(a - 0.3333333333333333);
	else
		tmp = Float64(rand * Float64(sqrt(Float64(a + -0.3333333333333333)) / 3.0));
	end
	return tmp
end
function tmp_2 = code(a, rand)
	tmp = 0.0;
	if (rand <= -3.5e+79)
		tmp = rand * sqrt((-0.037037037037037035 + (a * 0.1111111111111111)));
	elseif (rand <= 7.2e+61)
		tmp = a - 0.3333333333333333;
	else
		tmp = rand * (sqrt((a + -0.3333333333333333)) / 3.0);
	end
	tmp_2 = tmp;
end
code[a_, rand_] := If[LessEqual[rand, -3.5e+79], N[(rand * N[Sqrt[N[(-0.037037037037037035 + N[(a * 0.1111111111111111), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[rand, 7.2e+61], N[(a - 0.3333333333333333), $MachinePrecision], N[(rand * N[(N[Sqrt[N[(a + -0.3333333333333333), $MachinePrecision]], $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;rand \leq -3.5 \cdot 10^{+79}:\\
\;\;\;\;rand \cdot \sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}\\

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

\mathbf{else}:\\
\;\;\;\;rand \cdot \frac{\sqrt{a + -0.3333333333333333}}{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if rand < -3.4999999999999998e79

    1. Initial program 99.7%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Step-by-step derivation
      1. remove-double-neg99.7%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg99.7%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg99.7%

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

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval99.7%

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

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

      \[\leadsto \color{blue}{\left(\left(a - 0.3333333333333333\right) \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}}} \]
    5. Step-by-step derivation
      1. sub-neg68.3%

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

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

        \[\leadsto \color{blue}{\left(rand \cdot \left(a + -0.3333333333333333\right)\right)} \cdot \sqrt{\frac{1}{9 \cdot a - 3}} \]
      4. associate-*l*90.2%

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

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{\color{blue}{9 \cdot a + \left(-3\right)}}}\right) \]
      6. metadata-eval90.2%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{-3}}}\right) \]
      7. metadata-eval90.2%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{9 \cdot -0.3333333333333333}}}\right) \]
      8. distribute-lft-in90.2%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}}\right) \]
      9. associate-/r*90.2%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{9}}{a + -0.3333333333333333}}}\right) \]
      10. metadata-eval90.2%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{\color{blue}{0.1111111111111111}}{a + -0.3333333333333333}}\right) \]
    6. Simplified90.2%

      \[\leadsto \color{blue}{rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{0.1111111111111111}{a + -0.3333333333333333}}\right)} \]
    7. Step-by-step derivation
      1. sqrt-div90.1%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \color{blue}{\frac{\sqrt{0.1111111111111111}}{\sqrt{a + -0.3333333333333333}}}\right) \]
      2. metadata-eval90.1%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \frac{\color{blue}{0.3333333333333333}}{\sqrt{a + -0.3333333333333333}}\right) \]
      3. associate-*r/90.0%

        \[\leadsto rand \cdot \color{blue}{\frac{\left(a + -0.3333333333333333\right) \cdot 0.3333333333333333}{\sqrt{a + -0.3333333333333333}}} \]
    8. Applied egg-rr90.0%

      \[\leadsto rand \cdot \color{blue}{\frac{\left(a + -0.3333333333333333\right) \cdot 0.3333333333333333}{\sqrt{a + -0.3333333333333333}}} \]
    9. Step-by-step derivation
      1. associate-/l*90.1%

        \[\leadsto rand \cdot \color{blue}{\frac{a + -0.3333333333333333}{\frac{\sqrt{a + -0.3333333333333333}}{0.3333333333333333}}} \]
      2. add-sqr-sqrt90.1%

        \[\leadsto rand \cdot \frac{\color{blue}{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}}{\frac{\sqrt{a + -0.3333333333333333}}{0.3333333333333333}} \]
      3. +-commutative90.1%

        \[\leadsto rand \cdot \frac{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}{\frac{\sqrt{\color{blue}{-0.3333333333333333 + a}}}{0.3333333333333333}} \]
      4. *-un-lft-identity90.1%

        \[\leadsto rand \cdot \frac{\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}}{\color{blue}{1 \cdot \frac{\sqrt{-0.3333333333333333 + a}}{0.3333333333333333}}} \]
      5. times-frac90.2%

        \[\leadsto rand \cdot \color{blue}{\left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\frac{\sqrt{-0.3333333333333333 + a}}{0.3333333333333333}}\right)} \]
      6. div-inv90.0%

        \[\leadsto rand \cdot \left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\color{blue}{\sqrt{-0.3333333333333333 + a} \cdot \frac{1}{0.3333333333333333}}}\right) \]
      7. +-commutative90.0%

        \[\leadsto rand \cdot \left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{\color{blue}{a + -0.3333333333333333}} \cdot \frac{1}{0.3333333333333333}}\right) \]
      8. metadata-eval90.0%

        \[\leadsto rand \cdot \left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot \color{blue}{3}}\right) \]
    10. Applied egg-rr90.0%

      \[\leadsto rand \cdot \color{blue}{\left(\frac{\sqrt{a + -0.3333333333333333}}{1} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot 3}\right)} \]
    11. Step-by-step derivation
      1. /-rgt-identity90.0%

        \[\leadsto rand \cdot \left(\color{blue}{\sqrt{a + -0.3333333333333333}} \cdot \frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333} \cdot 3}\right) \]
      2. associate-/r*90.2%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \color{blue}{\frac{\frac{\sqrt{a + -0.3333333333333333}}{\sqrt{a + -0.3333333333333333}}}{3}}\right) \]
      3. *-inverses90.2%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \frac{\color{blue}{1}}{3}\right) \]
      4. metadata-eval90.2%

        \[\leadsto rand \cdot \left(\sqrt{a + -0.3333333333333333} \cdot \color{blue}{0.3333333333333333}\right) \]
      5. *-commutative90.2%

        \[\leadsto rand \cdot \color{blue}{\left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)} \]
    12. Simplified90.2%

      \[\leadsto rand \cdot \color{blue}{\left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)} \]
    13. Step-by-step derivation
      1. add-sqr-sqrt89.9%

        \[\leadsto rand \cdot \color{blue}{\left(\sqrt{0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}} \cdot \sqrt{0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}}\right)} \]
      2. sqrt-unprod90.2%

        \[\leadsto rand \cdot \color{blue}{\sqrt{\left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right) \cdot \left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)}} \]
      3. *-commutative90.2%

        \[\leadsto rand \cdot \sqrt{\color{blue}{\left(\sqrt{a + -0.3333333333333333} \cdot 0.3333333333333333\right)} \cdot \left(0.3333333333333333 \cdot \sqrt{a + -0.3333333333333333}\right)} \]
      4. *-commutative90.2%

        \[\leadsto rand \cdot \sqrt{\left(\sqrt{a + -0.3333333333333333} \cdot 0.3333333333333333\right) \cdot \color{blue}{\left(\sqrt{a + -0.3333333333333333} \cdot 0.3333333333333333\right)}} \]
      5. swap-sqr90.2%

        \[\leadsto rand \cdot \sqrt{\color{blue}{\left(\sqrt{a + -0.3333333333333333} \cdot \sqrt{a + -0.3333333333333333}\right) \cdot \left(0.3333333333333333 \cdot 0.3333333333333333\right)}} \]
      6. add-sqr-sqrt90.3%

        \[\leadsto rand \cdot \sqrt{\color{blue}{\left(a + -0.3333333333333333\right)} \cdot \left(0.3333333333333333 \cdot 0.3333333333333333\right)} \]
      7. metadata-eval90.3%

        \[\leadsto rand \cdot \sqrt{\left(a + -0.3333333333333333\right) \cdot \color{blue}{0.1111111111111111}} \]
    14. Applied egg-rr90.3%

      \[\leadsto rand \cdot \color{blue}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 0.1111111111111111}} \]
    15. Step-by-step derivation
      1. *-commutative90.3%

        \[\leadsto rand \cdot \sqrt{\color{blue}{0.1111111111111111 \cdot \left(a + -0.3333333333333333\right)}} \]
      2. +-commutative90.3%

        \[\leadsto rand \cdot \sqrt{0.1111111111111111 \cdot \color{blue}{\left(-0.3333333333333333 + a\right)}} \]
      3. distribute-rgt-in90.3%

        \[\leadsto rand \cdot \sqrt{\color{blue}{-0.3333333333333333 \cdot 0.1111111111111111 + a \cdot 0.1111111111111111}} \]
      4. metadata-eval90.3%

        \[\leadsto rand \cdot \sqrt{\color{blue}{-0.037037037037037035} + a \cdot 0.1111111111111111} \]
    16. Simplified90.3%

      \[\leadsto rand \cdot \color{blue}{\sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}} \]

    if -3.4999999999999998e79 < rand < 7.20000000000000021e61

    1. Initial program 100.0%

      \[\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg100.0%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg100.0%

        \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      4. metadata-eval100.0%

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval100.0%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval100.0%

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

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

      \[\leadsto \color{blue}{a - 0.3333333333333333} \]

    if 7.20000000000000021e61 < 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. Step-by-step derivation
      1. remove-double-neg99.6%

        \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      2. remove-double-neg99.6%

        \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      3. sub-neg99.6%

        \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      4. metadata-eval99.6%

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

        \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
      6. remove-double-neg99.6%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
      7. remove-double-neg99.6%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
      8. associate-*l/99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1 \cdot rand}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}}\right) \]
      9. *-lft-identity99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{\color{blue}{rand}}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}}\right) \]
      10. sub-neg99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
      11. distribute-lft-in99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{\color{blue}{9 \cdot a + 9 \cdot \left(-\frac{1}{3}\right)}}}\right) \]
      12. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
      13. metadata-eval99.7%

        \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
      14. metadata-eval99.7%

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

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

      \[\leadsto \color{blue}{\left(\left(a - 0.3333333333333333\right) \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}}} \]
    5. Step-by-step derivation
      1. sub-neg68.6%

        \[\leadsto \left(\color{blue}{\left(a + \left(-0.3333333333333333\right)\right)} \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}} \]
      2. metadata-eval68.6%

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

        \[\leadsto \color{blue}{\left(rand \cdot \left(a + -0.3333333333333333\right)\right)} \cdot \sqrt{\frac{1}{9 \cdot a - 3}} \]
      4. associate-*l*87.9%

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

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

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

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{9 \cdot -0.3333333333333333}}}\right) \]
      8. distribute-lft-in87.9%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}}\right) \]
      9. associate-/r*88.0%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{9}}{a + -0.3333333333333333}}}\right) \]
      10. metadata-eval88.0%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{\color{blue}{0.1111111111111111}}{a + -0.3333333333333333}}\right) \]
    6. Simplified88.0%

      \[\leadsto \color{blue}{rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{0.1111111111111111}{a + -0.3333333333333333}}\right)} \]
    7. Step-by-step derivation
      1. sqrt-div87.8%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \color{blue}{\frac{\sqrt{0.1111111111111111}}{\sqrt{a + -0.3333333333333333}}}\right) \]
      2. metadata-eval87.8%

        \[\leadsto rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \frac{\color{blue}{0.3333333333333333}}{\sqrt{a + -0.3333333333333333}}\right) \]
      3. associate-*r/87.9%

        \[\leadsto rand \cdot \color{blue}{\frac{\left(a + -0.3333333333333333\right) \cdot 0.3333333333333333}{\sqrt{a + -0.3333333333333333}}} \]
    8. Applied egg-rr87.9%

      \[\leadsto rand \cdot \color{blue}{\frac{\left(a + -0.3333333333333333\right) \cdot 0.3333333333333333}{\sqrt{a + -0.3333333333333333}}} \]
    9. Step-by-step derivation
      1. associate-/l*87.8%

        \[\leadsto rand \cdot \color{blue}{\frac{a + -0.3333333333333333}{\frac{\sqrt{a + -0.3333333333333333}}{0.3333333333333333}}} \]
      2. *-un-lft-identity87.8%

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

        \[\leadsto rand \cdot \frac{1 \cdot \left(a + -0.3333333333333333\right)}{\frac{\sqrt{\color{blue}{-0.3333333333333333 + a}}}{0.3333333333333333}} \]
      4. div-inv87.7%

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

        \[\leadsto rand \cdot \frac{1 \cdot \left(a + -0.3333333333333333\right)}{\sqrt{\color{blue}{a + -0.3333333333333333}} \cdot \frac{1}{0.3333333333333333}} \]
      6. metadata-eval87.7%

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

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

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

        \[\leadsto rand \cdot \left(\color{blue}{{\left(a + -0.3333333333333333\right)}^{\left(\frac{-1}{2}\right)}} \cdot \frac{a + -0.3333333333333333}{3}\right) \]
      10. metadata-eval87.9%

        \[\leadsto rand \cdot \left({\left(a + -0.3333333333333333\right)}^{\color{blue}{-0.5}} \cdot \frac{a + -0.3333333333333333}{3}\right) \]
    10. Applied egg-rr87.9%

      \[\leadsto rand \cdot \color{blue}{\left({\left(a + -0.3333333333333333\right)}^{-0.5} \cdot \frac{a + -0.3333333333333333}{3}\right)} \]
    11. Step-by-step derivation
      1. associate-*r/87.9%

        \[\leadsto rand \cdot \color{blue}{\frac{{\left(a + -0.3333333333333333\right)}^{-0.5} \cdot \left(a + -0.3333333333333333\right)}{3}} \]
      2. pow-plus88.0%

        \[\leadsto rand \cdot \frac{\color{blue}{{\left(a + -0.3333333333333333\right)}^{\left(-0.5 + 1\right)}}}{3} \]
      3. metadata-eval88.0%

        \[\leadsto rand \cdot \frac{{\left(a + -0.3333333333333333\right)}^{\color{blue}{0.5}}}{3} \]
      4. unpow1/288.0%

        \[\leadsto rand \cdot \frac{\color{blue}{\sqrt{a + -0.3333333333333333}}}{3} \]
    12. Simplified88.0%

      \[\leadsto rand \cdot \color{blue}{\frac{\sqrt{a + -0.3333333333333333}}{3}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification95.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;rand \leq -3.5 \cdot 10^{+79}:\\ \;\;\;\;rand \cdot \sqrt{-0.037037037037037035 + a \cdot 0.1111111111111111}\\ \mathbf{elif}\;rand \leq 7.2 \cdot 10^{+61}:\\ \;\;\;\;a - 0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;rand \cdot \frac{\sqrt{a + -0.3333333333333333}}{3}\\ \end{array} \]

Alternative 7: 98.7% accurate, 1.1× speedup?

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

\\
\left(a + -0.3333333333333333\right) \cdot \left(1 + rand \cdot \sqrt{\frac{0.1111111111111111}{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. Step-by-step derivation
    1. sub-neg99.8%

      \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. metadata-eval99.8%

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

      \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    4. *-commutative99.8%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{1}{\sqrt{\color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot 9}} \cdot rand\right) \]
    6. metadata-eval99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{1}{\sqrt{\left(a + \left(-\color{blue}{0.3333333333333333}\right)\right) \cdot 9}} \cdot rand\right) \]
    7. metadata-eval99.8%

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

    \[\leadsto \color{blue}{\left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}} \cdot rand\right)} \]
  4. Step-by-step derivation
    1. add-sqr-sqrt99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(\sqrt{\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}} \cdot \sqrt{\frac{1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}\right)} \cdot rand\right) \]
    2. sqrt-unprod99.8%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sqrt{\left(a + -0.3333333333333333\right) \cdot 9} \cdot \sqrt{\left(a + -0.3333333333333333\right) \cdot 9}}}} \cdot rand\right) \]
    4. metadata-eval99.9%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{1}{\color{blue}{\left(a + -0.3333333333333333\right) \cdot 9}}} \cdot rand\right) \]
    6. *-commutative99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}} \cdot rand\right) \]
    7. distribute-rgt-in99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{1}{\color{blue}{a \cdot 9 + -0.3333333333333333 \cdot 9}}} \cdot rand\right) \]
    8. metadata-eval99.9%

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

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

    \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\sqrt{\frac{1}{\mathsf{fma}\left(a, 9, -3\right)}}} \cdot rand\right) \]
  6. Step-by-step derivation
    1. fma-def99.9%

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

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}} \cdot rand\right) \]
    4. associate-/r*99.9%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \sqrt{\frac{\color{blue}{0.1111111111111111}}{a + -0.3333333333333333}} \cdot rand\right) \]
  7. Simplified99.9%

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

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

    \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + rand \cdot \sqrt{\frac{0.1111111111111111}{a}}\right) \]

Alternative 8: 98.5% accurate, 1.1× speedup?

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

\\
a + 0.3333333333333333 \cdot \left(rand \cdot \sqrt{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. Step-by-step derivation
    1. remove-double-neg99.8%

      \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. remove-double-neg99.8%

      \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    3. sub-neg99.8%

      \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    4. metadata-eval99.8%

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

      \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    6. remove-double-neg99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
    7. remove-double-neg99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
    8. associate-*l/99.9%

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

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
    11. distribute-lft-in99.9%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
    13. metadata-eval99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
    14. metadata-eval99.9%

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

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

    \[\leadsto \color{blue}{\left(a + \left(\left(a - 0.3333333333333333\right) \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}}\right) - 0.3333333333333333} \]
  5. Step-by-step derivation
    1. associate--l+86.2%

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

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

      \[\leadsto a + \left(\left(\left(a + \color{blue}{-0.3333333333333333}\right) \cdot rand\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}} - 0.3333333333333333\right) \]
    4. *-commutative86.2%

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

      \[\leadsto a + \left(\color{blue}{rand \cdot \left(\left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a - 3}}\right)} - 0.3333333333333333\right) \]
    6. fma-neg99.8%

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

      \[\leadsto a + \mathsf{fma}\left(rand, \left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{\color{blue}{9 \cdot a + \left(-3\right)}}}, -0.3333333333333333\right) \]
    8. metadata-eval99.8%

      \[\leadsto a + \mathsf{fma}\left(rand, \left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{-3}}}, -0.3333333333333333\right) \]
    9. metadata-eval99.8%

      \[\leadsto a + \mathsf{fma}\left(rand, \left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{9 \cdot a + \color{blue}{9 \cdot -0.3333333333333333}}}, -0.3333333333333333\right) \]
    10. distribute-lft-in99.8%

      \[\leadsto a + \mathsf{fma}\left(rand, \left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{1}{\color{blue}{9 \cdot \left(a + -0.3333333333333333\right)}}}, -0.3333333333333333\right) \]
    11. associate-/r*99.9%

      \[\leadsto a + \mathsf{fma}\left(rand, \left(a + -0.3333333333333333\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{9}}{a + -0.3333333333333333}}}, -0.3333333333333333\right) \]
    12. metadata-eval99.9%

      \[\leadsto a + \mathsf{fma}\left(rand, \left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{\color{blue}{0.1111111111111111}}{a + -0.3333333333333333}}, -0.3333333333333333\right) \]
    13. metadata-eval99.9%

      \[\leadsto a + \mathsf{fma}\left(rand, \left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{0.1111111111111111}{a + -0.3333333333333333}}, \color{blue}{-0.3333333333333333}\right) \]
  6. Simplified99.9%

    \[\leadsto \color{blue}{a + \mathsf{fma}\left(rand, \left(a + -0.3333333333333333\right) \cdot \sqrt{\frac{0.1111111111111111}{a + -0.3333333333333333}}, -0.3333333333333333\right)} \]
  7. Taylor expanded in rand around inf 99.0%

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

    \[\leadsto a + 0.3333333333333333 \cdot \left(rand \cdot \sqrt{a - 0.3333333333333333}\right) \]

Alternative 9: 62.8% accurate, 39.7× 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. Step-by-step derivation
    1. remove-double-neg99.8%

      \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. remove-double-neg99.8%

      \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    3. sub-neg99.8%

      \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    4. metadata-eval99.8%

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

      \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    6. remove-double-neg99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
    7. remove-double-neg99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
    8. associate-*l/99.9%

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

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
    11. distribute-lft-in99.9%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
    13. metadata-eval99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
    14. metadata-eval99.9%

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

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

    \[\leadsto \color{blue}{a - 0.3333333333333333} \]
  5. Final simplification61.7%

    \[\leadsto a - 0.3333333333333333 \]

Alternative 10: 61.7% accurate, 119.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. Step-by-step derivation
    1. remove-double-neg99.8%

      \[\leadsto \color{blue}{\left(-\left(-\left(a - \frac{1}{3}\right)\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    2. remove-double-neg99.8%

      \[\leadsto \color{blue}{\left(a - \frac{1}{3}\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    3. sub-neg99.8%

      \[\leadsto \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)} \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    4. metadata-eval99.8%

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

      \[\leadsto \left(a + \color{blue}{-0.3333333333333333}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right) \]
    6. remove-double-neg99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\left(-\left(-\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)\right)}\right) \]
    7. remove-double-neg99.8%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \color{blue}{\frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand}\right) \]
    8. associate-*l/99.9%

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

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot \color{blue}{\left(a + \left(-\frac{1}{3}\right)\right)}}}\right) \]
    11. distribute-lft-in99.9%

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

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \left(-\color{blue}{0.3333333333333333}\right)}}\right) \]
    13. metadata-eval99.9%

      \[\leadsto \left(a + -0.3333333333333333\right) \cdot \left(1 + \frac{rand}{\sqrt{9 \cdot a + 9 \cdot \color{blue}{-0.3333333333333333}}}\right) \]
    14. metadata-eval99.9%

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

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

    \[\leadsto \color{blue}{a} \]
  5. Final simplification60.9%

    \[\leadsto a \]

Reproduce

?
herbie shell --seed 2023182 
(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))))