normal distribution

Percentage Accurate: 99.4% → 99.6%
Time: 6.7s
Alternatives: 3
Speedup: 1.5×

Specification

?
\[\left(0 \leq u1 \land u1 \leq 1\right) \land \left(0 \leq u2 \land u2 \leq 1\right)\]
\[\begin{array}{l} \\ \left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5 \end{array} \]
(FPCore (u1 u2)
 :precision binary64
 (+
  (* (* (/ 1.0 6.0) (pow (* -2.0 (log u1)) 0.5)) (cos (* (* 2.0 (PI)) u2)))
  0.5))
\begin{array}{l}

\\
\left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5
\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 3 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.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5 \end{array} \]
(FPCore (u1 u2)
 :precision binary64
 (+
  (* (* (/ 1.0 6.0) (pow (* -2.0 (log u1)) 0.5)) (cos (* (* 2.0 (PI)) u2)))
  0.5))
\begin{array}{l}

\\
\left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5
\end{array}

Alternative 1: 99.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\sqrt{-0.05555555555555555 \cdot \log u1}, \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right), 0.5\right) \end{array} \]
(FPCore (u1 u2)
 :precision binary64
 (fma (sqrt (* -0.05555555555555555 (log u1))) (cos (* (* 2.0 (PI)) u2)) 0.5))
\begin{array}{l}

\\
\mathsf{fma}\left(\sqrt{-0.05555555555555555 \cdot \log u1}, \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right), 0.5\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5 \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \left(\frac{1}{6} \cdot \color{blue}{{\left(-2 \cdot \log u1\right)}^{\frac{1}{2}}}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + \frac{1}{2} \]
    2. unpow1/2N/A

      \[\leadsto \left(\frac{1}{6} \cdot \color{blue}{\sqrt{-2 \cdot \log u1}}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + \frac{1}{2} \]
    3. lower-sqrt.f6499.4

      \[\leadsto \left(\frac{1}{6} \cdot \color{blue}{\sqrt{-2 \cdot \log u1}}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5 \]
    4. lift-*.f64N/A

      \[\leadsto \left(\frac{1}{6} \cdot \sqrt{\color{blue}{-2 \cdot \log u1}}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + \frac{1}{2} \]
    5. *-commutativeN/A

      \[\leadsto \left(\frac{1}{6} \cdot \sqrt{\color{blue}{\log u1 \cdot -2}}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + \frac{1}{2} \]
    6. lower-*.f6499.4

      \[\leadsto \left(\frac{1}{6} \cdot \sqrt{\color{blue}{\log u1 \cdot -2}}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5 \]
  4. Applied rewrites99.4%

    \[\leadsto \left(\frac{1}{6} \cdot \color{blue}{\sqrt{\log u1 \cdot -2}}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5 \]
  5. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(\frac{1}{6} \cdot \sqrt{\log u1 \cdot -2}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + \frac{1}{2}} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{\frac{1}{2} + \left(\frac{1}{6} \cdot \sqrt{\log u1 \cdot -2}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{1}{2} + \color{blue}{\left(\frac{1}{6} \cdot \sqrt{\log u1 \cdot -2}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right)} \]
    4. *-commutativeN/A

      \[\leadsto \frac{1}{2} + \color{blue}{\cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \left(\frac{1}{6} \cdot \sqrt{\log u1 \cdot -2}\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{1}{2} + \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \color{blue}{\left(\frac{1}{6} \cdot \sqrt{\log u1 \cdot -2}\right)} \]
    6. lift-sqrt.f64N/A

      \[\leadsto \frac{1}{2} + \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \left(\frac{1}{6} \cdot \color{blue}{\sqrt{\log u1 \cdot -2}}\right) \]
    7. pow1/2N/A

      \[\leadsto \frac{1}{2} + \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \left(\frac{1}{6} \cdot \color{blue}{{\left(\log u1 \cdot -2\right)}^{\frac{1}{2}}}\right) \]
    8. metadata-evalN/A

      \[\leadsto \frac{1}{2} + \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \left(\frac{1}{6} \cdot {\left(\log u1 \cdot -2\right)}^{\color{blue}{\left(\frac{1}{4} \cdot 2\right)}}\right) \]
    9. pow-powN/A

      \[\leadsto \frac{1}{2} + \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \left(\frac{1}{6} \cdot \color{blue}{{\left({\left(\log u1 \cdot -2\right)}^{\frac{1}{4}}\right)}^{2}}\right) \]
    10. lift-pow.f64N/A

      \[\leadsto \frac{1}{2} + \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \left(\frac{1}{6} \cdot {\color{blue}{\left({\left(\log u1 \cdot -2\right)}^{\frac{1}{4}}\right)}}^{2}\right) \]
    11. lift-pow.f64N/A

      \[\leadsto \frac{1}{2} + \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \left(\frac{1}{6} \cdot \color{blue}{{\left({\left(\log u1 \cdot -2\right)}^{\frac{1}{4}}\right)}^{2}}\right) \]
    12. lift-*.f64N/A

      \[\leadsto \frac{1}{2} + \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) \cdot \color{blue}{\left(\frac{1}{6} \cdot {\left({\left(\log u1 \cdot -2\right)}^{\frac{1}{4}}\right)}^{2}\right)} \]
    13. *-commutativeN/A

      \[\leadsto \frac{1}{2} + \color{blue}{\left(\frac{1}{6} \cdot {\left({\left(\log u1 \cdot -2\right)}^{\frac{1}{4}}\right)}^{2}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right)} \]
    14. lift-*.f64N/A

      \[\leadsto \frac{1}{2} + \color{blue}{\left(\frac{1}{6} \cdot {\left({\left(\log u1 \cdot -2\right)}^{\frac{1}{4}}\right)}^{2}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right)} \]
  6. Applied rewrites99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\log u1 \cdot -2} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right), 0.16666666666666666, 0.5\right)} \]
  7. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \color{blue}{\left(\sqrt{\log u1 \cdot -2} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{1}{6} + \frac{1}{2}} \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{\frac{1}{6} \cdot \left(\sqrt{\log u1 \cdot -2} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right)} + \frac{1}{2} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{1}{6} \cdot \color{blue}{\left(\sqrt{\log u1 \cdot -2} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right)} + \frac{1}{2} \]
    4. associate-*r*N/A

      \[\leadsto \color{blue}{\left(\frac{1}{6} \cdot \sqrt{\log u1 \cdot -2}\right) \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)} + \frac{1}{2} \]
    5. *-commutativeN/A

      \[\leadsto \color{blue}{\left(\sqrt{\log u1 \cdot -2} \cdot \frac{1}{6}\right)} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right) + \frac{1}{2} \]
    6. lift-sqrt.f64N/A

      \[\leadsto \left(\color{blue}{\sqrt{\log u1 \cdot -2}} \cdot \frac{1}{6}\right) \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right) + \frac{1}{2} \]
    7. metadata-evalN/A

      \[\leadsto \left(\sqrt{\log u1 \cdot -2} \cdot \color{blue}{\sqrt{\frac{1}{36}}}\right) \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right) + \frac{1}{2} \]
    8. sqrt-prodN/A

      \[\leadsto \color{blue}{\sqrt{\left(\log u1 \cdot -2\right) \cdot \frac{1}{36}}} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right) + \frac{1}{2} \]
    9. unpow1N/A

      \[\leadsto \sqrt{\color{blue}{{\left(\log u1 \cdot -2\right)}^{1}} \cdot \frac{1}{36}} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right) + \frac{1}{2} \]
    10. lift-pow.f64N/A

      \[\leadsto \sqrt{\color{blue}{{\left(\log u1 \cdot -2\right)}^{1}} \cdot \frac{1}{36}} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right) + \frac{1}{2} \]
    11. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{{\left(\log u1 \cdot -2\right)}^{1} \cdot \frac{1}{36}}} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right) + \frac{1}{2} \]
    12. lift-sqrt.f64N/A

      \[\leadsto \color{blue}{\sqrt{{\left(\log u1 \cdot -2\right)}^{1} \cdot \frac{1}{36}}} \cdot \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right) + \frac{1}{2} \]
    13. lower-fma.f6499.6

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{{\left(\log u1 \cdot -2\right)}^{1} \cdot 0.027777777777777776}, \cos \left(u2 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right), 0.5\right)} \]
  8. Applied rewrites99.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{-0.05555555555555555 \cdot \log u1}, \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right), 0.5\right)} \]
  9. Add Preprocessing

Alternative 2: 98.5% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\sqrt{2} \cdot 0.16666666666666666, \sqrt{-\log u1}, 0.5\right) \end{array} \]
(FPCore (u1 u2)
 :precision binary64
 (fma (* (sqrt 2.0) 0.16666666666666666) (sqrt (- (log u1))) 0.5))
double code(double u1, double u2) {
	return fma((sqrt(2.0) * 0.16666666666666666), sqrt(-log(u1)), 0.5);
}
function code(u1, u2)
	return fma(Float64(sqrt(2.0) * 0.16666666666666666), sqrt(Float64(-log(u1))), 0.5)
end
code[u1_, u2_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * N[Sqrt[(-N[Log[u1], $MachinePrecision])], $MachinePrecision] + 0.5), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\sqrt{2} \cdot 0.16666666666666666, \sqrt{-\log u1}, 0.5\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5 \]
  2. Add Preprocessing
  3. Applied rewrites98.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\log u1 \cdot -2\right)}^{0.25}, {\left(\log u1 \cdot -2\right)}^{0.25} \cdot 0.16666666666666666, 0.5\right)} \]
  4. Taylor expanded in u1 around inf

    \[\leadsto \color{blue}{\frac{1}{2} + \frac{1}{6} \cdot \left(\sqrt{\log \left(\frac{1}{u1}\right)} \cdot \sqrt{2}\right)} \]
  5. Step-by-step derivation
    1. +-commutativeN/A

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{6} \cdot \sqrt{2}\right) \cdot \sqrt{\log \left(\frac{1}{u1}\right)}} + \frac{1}{2} \]
    4. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{6} \cdot \sqrt{2}, \sqrt{\log \left(\frac{1}{u1}\right)}, \frac{1}{2}\right)} \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{2} \cdot \frac{1}{6}}, \sqrt{\log \left(\frac{1}{u1}\right)}, \frac{1}{2}\right) \]
    6. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{2} \cdot \frac{1}{6}}, \sqrt{\log \left(\frac{1}{u1}\right)}, \frac{1}{2}\right) \]
    7. lower-sqrt.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{2}} \cdot \frac{1}{6}, \sqrt{\log \left(\frac{1}{u1}\right)}, \frac{1}{2}\right) \]
    8. lower-sqrt.f64N/A

      \[\leadsto \mathsf{fma}\left(\sqrt{2} \cdot \frac{1}{6}, \color{blue}{\sqrt{\log \left(\frac{1}{u1}\right)}}, \frac{1}{2}\right) \]
    9. log-recN/A

      \[\leadsto \mathsf{fma}\left(\sqrt{2} \cdot \frac{1}{6}, \sqrt{\color{blue}{\mathsf{neg}\left(\log u1\right)}}, \frac{1}{2}\right) \]
    10. lower-neg.f64N/A

      \[\leadsto \mathsf{fma}\left(\sqrt{2} \cdot \frac{1}{6}, \sqrt{\color{blue}{-\log u1}}, \frac{1}{2}\right) \]
    11. lower-log.f6499.1

      \[\leadsto \mathsf{fma}\left(\sqrt{2} \cdot 0.16666666666666666, \sqrt{-\color{blue}{\log u1}}, 0.5\right) \]
  6. Applied rewrites99.1%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{2} \cdot 0.16666666666666666, \sqrt{-\log u1}, 0.5\right)} \]
  7. Add Preprocessing

Alternative 3: 98.5% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \sqrt{\log u1 \cdot -0.05555555555555555} + 0.5 \end{array} \]
(FPCore (u1 u2)
 :precision binary64
 (+ (sqrt (* (log u1) -0.05555555555555555)) 0.5))
double code(double u1, double u2) {
	return sqrt((log(u1) * -0.05555555555555555)) + 0.5;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(u1, u2)
use fmin_fmax_functions
    real(8), intent (in) :: u1
    real(8), intent (in) :: u2
    code = sqrt((log(u1) * (-0.05555555555555555d0))) + 0.5d0
end function
public static double code(double u1, double u2) {
	return Math.sqrt((Math.log(u1) * -0.05555555555555555)) + 0.5;
}
def code(u1, u2):
	return math.sqrt((math.log(u1) * -0.05555555555555555)) + 0.5
function code(u1, u2)
	return Float64(sqrt(Float64(log(u1) * -0.05555555555555555)) + 0.5)
end
function tmp = code(u1, u2)
	tmp = sqrt((log(u1) * -0.05555555555555555)) + 0.5;
end
code[u1_, u2_] := N[(N[Sqrt[N[(N[Log[u1], $MachinePrecision] * -0.05555555555555555), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{\log u1 \cdot -0.05555555555555555} + 0.5
\end{array}
Derivation
  1. Initial program 99.4%

    \[\left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u2\right) + 0.5 \]
  2. Add Preprocessing
  3. Applied rewrites99.0%

    \[\leadsto \color{blue}{\sqrt{{\left(\log u1 \cdot -2\right)}^{1} \cdot 0.027777777777777776}} + 0.5 \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{{\left(\log u1 \cdot -2\right)}^{1} \cdot \frac{1}{36}}} + \frac{1}{2} \]
    2. lift-pow.f64N/A

      \[\leadsto \sqrt{\color{blue}{{\left(\log u1 \cdot -2\right)}^{1}} \cdot \frac{1}{36}} + \frac{1}{2} \]
    3. unpow1N/A

      \[\leadsto \sqrt{\color{blue}{\left(\log u1 \cdot -2\right)} \cdot \frac{1}{36}} + \frac{1}{2} \]
    4. lift-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\left(\log u1 \cdot -2\right)} \cdot \frac{1}{36}} + \frac{1}{2} \]
    5. associate-*l*N/A

      \[\leadsto \sqrt{\color{blue}{\log u1 \cdot \left(-2 \cdot \frac{1}{36}\right)}} + \frac{1}{2} \]
    6. metadata-evalN/A

      \[\leadsto \sqrt{\log u1 \cdot \color{blue}{\frac{-1}{18}}} + \frac{1}{2} \]
    7. metadata-evalN/A

      \[\leadsto \sqrt{\log u1 \cdot \color{blue}{\left(\frac{1}{36} \cdot -2\right)}} + \frac{1}{2} \]
    8. lower-*.f64N/A

      \[\leadsto \sqrt{\color{blue}{\log u1 \cdot \left(\frac{1}{36} \cdot -2\right)}} + \frac{1}{2} \]
    9. metadata-eval99.0

      \[\leadsto \sqrt{\log u1 \cdot \color{blue}{-0.05555555555555555}} + 0.5 \]
  5. Applied rewrites99.0%

    \[\leadsto \sqrt{\color{blue}{\log u1 \cdot -0.05555555555555555}} + 0.5 \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024350 
(FPCore (u1 u2)
  :name "normal distribution"
  :precision binary64
  :pre (and (and (<= 0.0 u1) (<= u1 1.0)) (and (<= 0.0 u2) (<= u2 1.0)))
  (+ (* (* (/ 1.0 6.0) (pow (* -2.0 (log u1)) 0.5)) (cos (* (* 2.0 (PI)) u2))) 0.5))