Beckmann Distribution sample, tan2theta, alphax != alphay, u1 <= 0.5

Percentage Accurate: 61.0% → 96.3%
Time: 16.3s
Alternatives: 17
Speedup: 3.5×

Specification

?
\[\left(\left(\left(\left(0.0001 \leq alphax \land alphax \leq 1\right) \land \left(0.0001 \leq alphay \land alphay \leq 1\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq u0 \land u0 \leq 1\right)\right) \land \left(0 \leq cos2phi \land cos2phi \leq 1\right)\right) \land 0 \leq sin2phi\]
\[\begin{array}{l} \\ \frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (- (log (- 1.0 u0)))
  (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return -logf((1.0f - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    code = -log((1.0e0 - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(-log(Float32(Float32(1.0) - u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay))))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = -log((single(1.0) - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
end
\begin{array}{l}

\\
\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}

Sampling outcomes in binary32 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 17 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: 61.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (- (log (- 1.0 u0)))
  (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return -logf((1.0f - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    code = -log((1.0e0 - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(-log(Float32(Float32(1.0) - u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay))))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = -log((single(1.0) - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
end
\begin{array}{l}

\\
\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}

Alternative 1: 96.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-0.5}\\ \mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\ \;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{sin2phi}{-alphay \cdot alphay} - t\_0 \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (pow (/ (* alphax alphax) cos2phi) -0.5)))
   (if (<= (- 1.0 u0) 0.9965000152587891)
     (/ (log (- 1.0 u0)) (- (/ sin2phi (- (* alphay alphay))) (* t_0 t_0)))
     (/
      (- u0 (* u0 (* u0 -0.5)))
      (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = powf(((alphax * alphax) / cos2phi), -0.5f);
	float tmp;
	if ((1.0f - u0) <= 0.9965000152587891f) {
		tmp = logf((1.0f - u0)) / ((sin2phi / -(alphay * alphay)) - (t_0 * t_0));
	} else {
		tmp = (u0 - (u0 * (u0 * -0.5f))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: t_0
    real(4) :: tmp
    t_0 = ((alphax * alphax) / cos2phi) ** (-0.5e0)
    if ((1.0e0 - u0) <= 0.9965000152587891e0) then
        tmp = log((1.0e0 - u0)) / ((sin2phi / -(alphay * alphay)) - (t_0 * t_0))
    else
        tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)))
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(Float32(alphax * alphax) / cos2phi) ^ Float32(-0.5)
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - u0) <= Float32(0.9965000152587891))
		tmp = Float32(log(Float32(Float32(1.0) - u0)) / Float32(Float32(sin2phi / Float32(-Float32(alphay * alphay))) - Float32(t_0 * t_0)));
	else
		tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax))));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = ((alphax * alphax) / cos2phi) ^ single(-0.5);
	tmp = single(0.0);
	if ((single(1.0) - u0) <= single(0.9965000152587891))
		tmp = log((single(1.0) - u0)) / ((sin2phi / -(alphay * alphay)) - (t_0 * t_0));
	else
		tmp = (u0 - (u0 * (u0 * single(-0.5)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-0.5}\\
\mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\
\;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{sin2phi}{-alphay \cdot alphay} - t\_0 \cdot t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 #s(literal 1 binary32) u0) < 0.99650002

    1. Initial program 93.4%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. clear-numN/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\color{blue}{\frac{1}{\frac{alphax \cdot alphax}{cos2phi}}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. inv-powN/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\color{blue}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-1}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. sqr-powN/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\color{blue}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\color{blue}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-pow.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\color{blue}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)}} \cdot {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{{\color{blue}{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)} + \frac{sin2phi}{alphay \cdot alphay}} \]
      8. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\color{blue}{\frac{-1}{2}}} \cdot {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)} + \frac{sin2phi}{alphay \cdot alphay}} \]
      9. lower-pow.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\frac{-1}{2}} \cdot \color{blue}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\left(\frac{-1}{2}\right)}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      10. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\frac{-1}{2}} \cdot {\color{blue}{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}}^{\left(\frac{-1}{2}\right)} + \frac{sin2phi}{alphay \cdot alphay}} \]
      11. metadata-eval93.5

        \[\leadsto \frac{-\log \left(1 - u0\right)}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-0.5} \cdot {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{\color{blue}{-0.5}} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Applied rewrites93.5%

      \[\leadsto \frac{-\log \left(1 - u0\right)}{\color{blue}{{\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-0.5} \cdot {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-0.5}} + \frac{sin2phi}{alphay \cdot alphay}} \]

    if 0.99650002 < (-.f32 #s(literal 1 binary32) u0)

    1. Initial program 49.9%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3217.6

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites17.5%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3298.1

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites98.1%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\ \;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{sin2phi}{-alphay \cdot alphay} - {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-0.5} \cdot {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-0.5}}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 91.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;-\log \left(1 - u0\right) \leq 0.027000000700354576:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(\frac{1}{1 - u0}\right)}{t\_0}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (/ sin2phi (* alphay alphay))))
   (if (<= (- (log (- 1.0 u0))) 0.027000000700354576)
     (/ (- u0 (* u0 (* u0 -0.5))) (+ t_0 (/ cos2phi (* alphax alphax))))
     (/ (log (/ 1.0 (- 1.0 u0))) t_0))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = sin2phi / (alphay * alphay);
	float tmp;
	if (-logf((1.0f - u0)) <= 0.027000000700354576f) {
		tmp = (u0 - (u0 * (u0 * -0.5f))) / (t_0 + (cos2phi / (alphax * alphax)));
	} else {
		tmp = logf((1.0f / (1.0f - u0))) / t_0;
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: t_0
    real(4) :: tmp
    t_0 = sin2phi / (alphay * alphay)
    if (-log((1.0e0 - u0)) <= 0.027000000700354576e0) then
        tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / (t_0 + (cos2phi / (alphax * alphax)))
    else
        tmp = log((1.0e0 / (1.0e0 - u0))) / t_0
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(sin2phi / Float32(alphay * alphay))
	tmp = Float32(0.0)
	if (Float32(-log(Float32(Float32(1.0) - u0))) <= Float32(0.027000000700354576))
		tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(t_0 + Float32(cos2phi / Float32(alphax * alphax))));
	else
		tmp = Float32(log(Float32(Float32(1.0) / Float32(Float32(1.0) - u0))) / t_0);
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = sin2phi / (alphay * alphay);
	tmp = single(0.0);
	if (-log((single(1.0) - u0)) <= single(0.027000000700354576))
		tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (t_0 + (cos2phi / (alphax * alphax)));
	else
		tmp = log((single(1.0) / (single(1.0) - u0))) / t_0;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;-\log \left(1 - u0\right) \leq 0.027000000700354576:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{1}{1 - u0}\right)}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (neg.f32 (log.f32 (-.f32 #s(literal 1 binary32) u0))) < 0.0270000007

    1. Initial program 54.8%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3216.4

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites16.3%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3295.0

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites95.0%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]

    if 0.0270000007 < (neg.f32 (log.f32 (-.f32 #s(literal 1 binary32) u0)))

    1. Initial program 96.3%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \color{blue}{\left(1 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. lift-log.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\log \left(1 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. remove-double-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log \left(1 - u0\right)\right)\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lift-log.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\log \left(1 - u0\right)}\right)\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. neg-logN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{1 - u0}\right)}\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. neg-logN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{\frac{1}{1 - u0}}\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. clear-numN/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \color{blue}{\left(\frac{1 - u0}{1}\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      8. log-recN/A

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{\frac{1 - u0}{1}}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      9. clear-numN/A

        \[\leadsto \frac{\log \color{blue}{\left(\frac{1}{1 - u0}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      10. lower-log.f32N/A

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{1 - u0}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      11. lower-/.f3295.2

        \[\leadsto \frac{\log \color{blue}{\left(\frac{1}{1 - u0}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Applied rewrites95.2%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{1 - u0}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Taylor expanded in cos2phi around 0

      \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
    6. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      2. unpow2N/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      3. lower-*.f3274.1

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    7. Applied rewrites74.1%

      \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{sin2phi}{alphay \cdot alphay}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;-\log \left(1 - u0\right) \leq 0.027000000700354576:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(\frac{1}{1 - u0}\right)}{\frac{sin2phi}{alphay \cdot alphay}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 96.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}\\ \mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\ \;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{1}{\frac{-1}{t\_0}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))
   (if (<= (- 1.0 u0) 0.9965000152587891)
     (/ (log (- 1.0 u0)) (/ 1.0 (/ -1.0 t_0)))
     (/ (- u0 (* u0 (* u0 -0.5))) t_0))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = (sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax));
	float tmp;
	if ((1.0f - u0) <= 0.9965000152587891f) {
		tmp = logf((1.0f - u0)) / (1.0f / (-1.0f / t_0));
	} else {
		tmp = (u0 - (u0 * (u0 * -0.5f))) / t_0;
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: t_0
    real(4) :: tmp
    t_0 = (sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax))
    if ((1.0e0 - u0) <= 0.9965000152587891e0) then
        tmp = log((1.0e0 - u0)) / (1.0e0 / ((-1.0e0) / t_0))
    else
        tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / t_0
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax)))
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - u0) <= Float32(0.9965000152587891))
		tmp = Float32(log(Float32(Float32(1.0) - u0)) / Float32(Float32(1.0) / Float32(Float32(-1.0) / t_0)));
	else
		tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / t_0);
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = (sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax));
	tmp = single(0.0);
	if ((single(1.0) - u0) <= single(0.9965000152587891))
		tmp = log((single(1.0) - u0)) / (single(1.0) / (single(-1.0) / t_0));
	else
		tmp = (u0 - (u0 * (u0 * single(-0.5)))) / t_0;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}\\
\mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\
\;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{1}{\frac{-1}{t\_0}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 #s(literal 1 binary32) u0) < 0.99650002

    1. Initial program 93.4%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \color{blue}{\left(1 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. lift-log.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\log \left(1 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. remove-double-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log \left(1 - u0\right)\right)\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lift-log.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\log \left(1 - u0\right)}\right)\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. neg-logN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{1 - u0}\right)}\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. neg-logN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{\frac{1}{1 - u0}}\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. clear-numN/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \color{blue}{\left(\frac{1 - u0}{1}\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      8. log-recN/A

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{\frac{1 - u0}{1}}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      9. clear-numN/A

        \[\leadsto \frac{\log \color{blue}{\left(\frac{1}{1 - u0}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      10. lower-log.f32N/A

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{1 - u0}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      11. lower-/.f3291.3

        \[\leadsto \frac{\log \color{blue}{\left(\frac{1}{1 - u0}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Applied rewrites91.3%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{1 - u0}\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. lift-/.f32N/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{cos2phi}{alphax \cdot alphax}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. lift-*.f32N/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      4. lift-/.f32N/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{alphay \cdot alphay}}} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}} \]
      6. flip-+N/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{\frac{sin2phi}{alphay \cdot alphay} \cdot \frac{sin2phi}{alphay \cdot alphay} - \frac{cos2phi}{alphax \cdot alphax} \cdot \frac{cos2phi}{alphax \cdot alphax}}{\frac{sin2phi}{alphay \cdot alphay} - \frac{cos2phi}{alphax \cdot alphax}}}} \]
      7. lower-/.f32N/A

        \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{\frac{sin2phi}{alphay \cdot alphay} \cdot \frac{sin2phi}{alphay \cdot alphay} - \frac{cos2phi}{alphax \cdot alphax} \cdot \frac{cos2phi}{alphax \cdot alphax}}{\frac{sin2phi}{alphay \cdot alphay} - \frac{cos2phi}{alphax \cdot alphax}}}} \]
    6. Applied rewrites63.2%

      \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{\frac{sin2phi \cdot sin2phi}{alphay \cdot \left(alphay \cdot \left(alphay \cdot alphay\right)\right)} - \frac{cos2phi \cdot cos2phi}{alphax \cdot \left(alphax \cdot \left(alphax \cdot alphax\right)\right)}}{\frac{sin2phi}{alphay \cdot alphay} - \frac{cos2phi}{alphax \cdot alphax}}}} \]
    7. Applied rewrites91.3%

      \[\leadsto \frac{\log \left(\frac{1}{1 - u0}\right)}{\color{blue}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}}} \]
    8. Step-by-step derivation
      1. lift--.f32N/A

        \[\leadsto \frac{\log \left(\frac{1}{\color{blue}{1 - u0}}\right)}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      2. /-rgt-identityN/A

        \[\leadsto \frac{\log \left(\frac{1}{\color{blue}{\frac{1 - u0}{1}}}\right)}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      3. clear-numN/A

        \[\leadsto \frac{\log \color{blue}{\left(\frac{1}{1 - u0}\right)}}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      4. frac-2negN/A

        \[\leadsto \frac{\log \color{blue}{\left(\frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(\left(1 - u0\right)\right)}\right)}}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\log \left(\frac{\color{blue}{-1}}{\mathsf{neg}\left(\left(1 - u0\right)\right)}\right)}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      6. frac-2negN/A

        \[\leadsto \frac{\log \color{blue}{\left(\frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(1 - u0\right)\right)\right)\right)}\right)}}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\log \left(\frac{\color{blue}{1}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(1 - u0\right)\right)\right)\right)}\right)}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      8. log-recN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\log \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(1 - u0\right)\right)\right)\right)\right)\right)}}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      9. lower-neg.f32N/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\log \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(1 - u0\right)\right)\right)\right)\right)\right)}}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      10. lower-log.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\log \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(1 - u0\right)\right)\right)\right)\right)}\right)}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      11. lower-neg.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(1 - u0\right)\right)\right)\right)\right)}\right)}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
      12. lower-neg.f3293.4

        \[\leadsto \frac{-\log \left(-\color{blue}{\left(-\left(1 - u0\right)\right)}\right)}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]
    9. Applied rewrites93.4%

      \[\leadsto \frac{\color{blue}{-\log \left(-\left(-\left(1 - u0\right)\right)\right)}}{\frac{1}{\frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}}} \]

    if 0.99650002 < (-.f32 #s(literal 1 binary32) u0)

    1. Initial program 49.9%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3217.6

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites17.5%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3298.1

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites98.1%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\ \;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{1}{\frac{-1}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 96.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\ \;\;\;\;\frac{\log \left(1 - u0\right)}{cos2phi \cdot \frac{-1}{alphax \cdot alphax} - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (/ sin2phi (* alphay alphay))))
   (if (<= (- 1.0 u0) 0.9965000152587891)
     (/ (log (- 1.0 u0)) (- (* cos2phi (/ -1.0 (* alphax alphax))) t_0))
     (/ (- u0 (* u0 (* u0 -0.5))) (+ t_0 (/ cos2phi (* alphax alphax)))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = sin2phi / (alphay * alphay);
	float tmp;
	if ((1.0f - u0) <= 0.9965000152587891f) {
		tmp = logf((1.0f - u0)) / ((cos2phi * (-1.0f / (alphax * alphax))) - t_0);
	} else {
		tmp = (u0 - (u0 * (u0 * -0.5f))) / (t_0 + (cos2phi / (alphax * alphax)));
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: t_0
    real(4) :: tmp
    t_0 = sin2phi / (alphay * alphay)
    if ((1.0e0 - u0) <= 0.9965000152587891e0) then
        tmp = log((1.0e0 - u0)) / ((cos2phi * ((-1.0e0) / (alphax * alphax))) - t_0)
    else
        tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / (t_0 + (cos2phi / (alphax * alphax)))
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(sin2phi / Float32(alphay * alphay))
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - u0) <= Float32(0.9965000152587891))
		tmp = Float32(log(Float32(Float32(1.0) - u0)) / Float32(Float32(cos2phi * Float32(Float32(-1.0) / Float32(alphax * alphax))) - t_0));
	else
		tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(t_0 + Float32(cos2phi / Float32(alphax * alphax))));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = sin2phi / (alphay * alphay);
	tmp = single(0.0);
	if ((single(1.0) - u0) <= single(0.9965000152587891))
		tmp = log((single(1.0) - u0)) / ((cos2phi * (single(-1.0) / (alphax * alphax))) - t_0);
	else
		tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (t_0 + (cos2phi / (alphax * alphax)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\
\;\;\;\;\frac{\log \left(1 - u0\right)}{cos2phi \cdot \frac{-1}{alphax \cdot alphax} - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 #s(literal 1 binary32) u0) < 0.99650002

    1. Initial program 93.4%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. clear-numN/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\color{blue}{\frac{1}{\frac{alphax \cdot alphax}{cos2phi}}} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\color{blue}{\frac{1}{alphax \cdot alphax} \cdot cos2phi} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\log \left(1 - u0\right)\right)}{\color{blue}{\frac{1}{alphax \cdot alphax} \cdot cos2phi} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-/.f3293.4

        \[\leadsto \frac{-\log \left(1 - u0\right)}{\color{blue}{\frac{1}{alphax \cdot alphax}} \cdot cos2phi + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Applied rewrites93.4%

      \[\leadsto \frac{-\log \left(1 - u0\right)}{\color{blue}{\frac{1}{alphax \cdot alphax} \cdot cos2phi} + \frac{sin2phi}{alphay \cdot alphay}} \]

    if 0.99650002 < (-.f32 #s(literal 1 binary32) u0)

    1. Initial program 49.9%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3217.6

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites17.5%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3298.1

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites98.1%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\ \;\;\;\;\frac{\log \left(1 - u0\right)}{cos2phi \cdot \frac{-1}{alphax \cdot alphax} - \frac{sin2phi}{alphay \cdot alphay}}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 96.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\ \;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot \left(-alphax\right)} - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (/ sin2phi (* alphay alphay))))
   (if (<= (- 1.0 u0) 0.9965000152587891)
     (/ (log (- 1.0 u0)) (- (/ cos2phi (* alphax (- alphax))) t_0))
     (/ (- u0 (* u0 (* u0 -0.5))) (+ t_0 (/ cos2phi (* alphax alphax)))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = sin2phi / (alphay * alphay);
	float tmp;
	if ((1.0f - u0) <= 0.9965000152587891f) {
		tmp = logf((1.0f - u0)) / ((cos2phi / (alphax * -alphax)) - t_0);
	} else {
		tmp = (u0 - (u0 * (u0 * -0.5f))) / (t_0 + (cos2phi / (alphax * alphax)));
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: t_0
    real(4) :: tmp
    t_0 = sin2phi / (alphay * alphay)
    if ((1.0e0 - u0) <= 0.9965000152587891e0) then
        tmp = log((1.0e0 - u0)) / ((cos2phi / (alphax * -alphax)) - t_0)
    else
        tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / (t_0 + (cos2phi / (alphax * alphax)))
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(sin2phi / Float32(alphay * alphay))
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - u0) <= Float32(0.9965000152587891))
		tmp = Float32(log(Float32(Float32(1.0) - u0)) / Float32(Float32(cos2phi / Float32(alphax * Float32(-alphax))) - t_0));
	else
		tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(t_0 + Float32(cos2phi / Float32(alphax * alphax))));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = sin2phi / (alphay * alphay);
	tmp = single(0.0);
	if ((single(1.0) - u0) <= single(0.9965000152587891))
		tmp = log((single(1.0) - u0)) / ((cos2phi / (alphax * -alphax)) - t_0);
	else
		tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (t_0 + (cos2phi / (alphax * alphax)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\
\;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot \left(-alphax\right)} - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 #s(literal 1 binary32) u0) < 0.99650002

    1. Initial program 93.4%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing

    if 0.99650002 < (-.f32 #s(literal 1 binary32) u0)

    1. Initial program 49.9%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3217.6

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites17.5%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3298.1

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites98.1%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\ \;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot \left(-alphax\right)} - \frac{sin2phi}{alphay \cdot alphay}}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 81.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 0.800000011920929:\\ \;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 0.800000011920929)
   (/ u0 (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay)))
   (* (* alphay alphay) (/ (- u0 (* -0.5 (* u0 u0))) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((sin2phi / (alphay * alphay)) <= 0.800000011920929f) {
		tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay));
	} else {
		tmp = (alphay * alphay) * ((u0 - (-0.5f * (u0 * u0))) / sin2phi);
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: tmp
    if ((sin2phi / (alphay * alphay)) <= 0.800000011920929e0) then
        tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay))
    else
        tmp = (alphay * alphay) * ((u0 - ((-0.5e0) * (u0 * u0))) / sin2phi)
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(0.800000011920929))
		tmp = Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay)));
	else
		tmp = Float32(Float32(alphay * alphay) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / sin2phi));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(0.800000011920929))
		tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay));
	else
		tmp = (alphay * alphay) * ((u0 - (single(-0.5) * (u0 * u0))) / sin2phi);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 0.800000011920929:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}\\

\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 0.800000012

    1. Initial program 54.7%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3275.8

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites75.8%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    6. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      3. lower-/.f3275.9

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{\frac{sin2phi}{alphay}}}{alphay}} \]
    7. Applied rewrites75.9%

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]

    if 0.800000012 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 66.1%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3223.8

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites23.7%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3287.4

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites87.4%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      3. lower-/.f3287.4

        \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{\frac{sin2phi}{alphay}}}{alphay}} \]
    9. Applied rewrites87.4%

      \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{sin2phi}} \]
    11. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      2. div-subN/A

        \[\leadsto {alphay}^{2} \cdot \color{blue}{\left(\frac{u0}{sin2phi} - \frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}\right)} \]
      3. associate-*r/N/A

        \[\leadsto {alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}}\right) \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right)} \]
      5. unpow2N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      6. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}}\right) \]
      8. div-subN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      9. lower-/.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      10. lower--.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{\color{blue}{u0 - \frac{-1}{2} \cdot {u0}^{2}}}{sin2phi} \]
      11. *-commutativeN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      12. lower-*.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      13. unpow2N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot \frac{-1}{2}}{sin2phi} \]
      14. lower-*.f3286.6

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot -0.5}{sin2phi} \]
    12. Applied rewrites86.6%

      \[\leadsto \color{blue}{\left(alphay \cdot alphay\right) \cdot \frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 0.800000011920929:\\ \;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 81.4% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;t\_0 \leq 0.800000011920929:\\ \;\;\;\;\frac{u0}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (/ sin2phi (* alphay alphay))))
   (if (<= t_0 0.800000011920929)
     (/ u0 (+ t_0 (/ cos2phi (* alphax alphax))))
     (* (* alphay alphay) (/ (- u0 (* -0.5 (* u0 u0))) sin2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = sin2phi / (alphay * alphay);
	float tmp;
	if (t_0 <= 0.800000011920929f) {
		tmp = u0 / (t_0 + (cos2phi / (alphax * alphax)));
	} else {
		tmp = (alphay * alphay) * ((u0 - (-0.5f * (u0 * u0))) / sin2phi);
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: t_0
    real(4) :: tmp
    t_0 = sin2phi / (alphay * alphay)
    if (t_0 <= 0.800000011920929e0) then
        tmp = u0 / (t_0 + (cos2phi / (alphax * alphax)))
    else
        tmp = (alphay * alphay) * ((u0 - ((-0.5e0) * (u0 * u0))) / sin2phi)
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(sin2phi / Float32(alphay * alphay))
	tmp = Float32(0.0)
	if (t_0 <= Float32(0.800000011920929))
		tmp = Float32(u0 / Float32(t_0 + Float32(cos2phi / Float32(alphax * alphax))));
	else
		tmp = Float32(Float32(alphay * alphay) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / sin2phi));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = sin2phi / (alphay * alphay);
	tmp = single(0.0);
	if (t_0 <= single(0.800000011920929))
		tmp = u0 / (t_0 + (cos2phi / (alphax * alphax)));
	else
		tmp = (alphay * alphay) * ((u0 - (single(-0.5) * (u0 * u0))) / sin2phi);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;t\_0 \leq 0.800000011920929:\\
\;\;\;\;\frac{u0}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\

\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 0.800000012

    1. Initial program 54.7%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3275.8

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites75.8%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]

    if 0.800000012 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 66.1%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3223.8

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites23.7%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3287.4

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites87.4%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      3. lower-/.f3287.4

        \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{\frac{sin2phi}{alphay}}}{alphay}} \]
    9. Applied rewrites87.4%

      \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{sin2phi}} \]
    11. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      2. div-subN/A

        \[\leadsto {alphay}^{2} \cdot \color{blue}{\left(\frac{u0}{sin2phi} - \frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}\right)} \]
      3. associate-*r/N/A

        \[\leadsto {alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}}\right) \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right)} \]
      5. unpow2N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      6. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}}\right) \]
      8. div-subN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      9. lower-/.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      10. lower--.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{\color{blue}{u0 - \frac{-1}{2} \cdot {u0}^{2}}}{sin2phi} \]
      11. *-commutativeN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      12. lower-*.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      13. unpow2N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot \frac{-1}{2}}{sin2phi} \]
      14. lower-*.f3286.6

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot -0.5}{sin2phi} \]
    12. Applied rewrites86.6%

      \[\leadsto \color{blue}{\left(alphay \cdot alphay\right) \cdot \frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 0.800000011920929:\\ \;\;\;\;\frac{u0}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 75.7% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{cos2phi}{alphax \cdot alphax}}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 6.999999885293207e-11)
   (/ (- u0 (* u0 (* u0 -0.5))) (/ cos2phi (* alphax alphax)))
   (* (* alphay alphay) (/ (- u0 (* -0.5 (* u0 u0))) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11f) {
		tmp = (u0 - (u0 * (u0 * -0.5f))) / (cos2phi / (alphax * alphax));
	} else {
		tmp = (alphay * alphay) * ((u0 - (-0.5f * (u0 * u0))) / sin2phi);
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: tmp
    if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11) then
        tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / (cos2phi / (alphax * alphax))
    else
        tmp = (alphay * alphay) * ((u0 - ((-0.5e0) * (u0 * u0))) / sin2phi)
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(6.999999885293207e-11))
		tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(cos2phi / Float32(alphax * alphax)));
	else
		tmp = Float32(Float32(alphay * alphay) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / sin2phi));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(6.999999885293207e-11))
		tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (cos2phi / (alphax * alphax));
	else
		tmp = (alphay * alphay) * ((u0 - (single(-0.5) * (u0 * u0))) / sin2phi);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{cos2phi}{alphax \cdot alphax}}\\

\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 6.99999989e-11

    1. Initial program 57.3%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f322.8

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites2.9%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3286.1

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites86.1%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Taylor expanded in cos2phi around inf

      \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}}} \]
    9. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}}} \]
      2. unpow2N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}}} \]
      3. lower-*.f3260.8

        \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}}} \]
    10. Applied rewrites60.8%

      \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\color{blue}{\frac{cos2phi}{alphax \cdot alphax}}} \]

    if 6.99999989e-11 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 62.6%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3219.5

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites19.5%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3288.6

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites88.6%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      3. lower-/.f3288.6

        \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{\frac{sin2phi}{alphay}}}{alphay}} \]
    9. Applied rewrites88.6%

      \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{sin2phi}} \]
    11. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      2. div-subN/A

        \[\leadsto {alphay}^{2} \cdot \color{blue}{\left(\frac{u0}{sin2phi} - \frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}\right)} \]
      3. associate-*r/N/A

        \[\leadsto {alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}}\right) \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right)} \]
      5. unpow2N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      6. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}}\right) \]
      8. div-subN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      9. lower-/.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      10. lower--.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{\color{blue}{u0 - \frac{-1}{2} \cdot {u0}^{2}}}{sin2phi} \]
      11. *-commutativeN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      12. lower-*.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      13. unpow2N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot \frac{-1}{2}}{sin2phi} \]
      14. lower-*.f3281.5

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot -0.5}{sin2phi} \]
    12. Applied rewrites81.5%

      \[\leadsto \color{blue}{\left(alphay \cdot alphay\right) \cdot \frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{cos2phi}{alphax \cdot alphax}}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 87.4% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (- u0 (* u0 (* u0 -0.5)))
  (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return (u0 - (u0 * (u0 * -0.5f))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    code = (u0 - (u0 * (u0 * (-0.5e0)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax))))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = (u0 - (u0 * (u0 * single(-0.5)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
end
\begin{array}{l}

\\
\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Derivation
  1. Initial program 61.1%

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Add Preprocessing
  3. Taylor expanded in u0 around 0

    \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  4. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. sub-negN/A

      \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    3. *-commutativeN/A

      \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. metadata-evalN/A

      \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. lower-fma.f3214.8

      \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  5. Applied rewrites14.7%

    \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  6. Step-by-step derivation
    1. distribute-rgt-inN/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. neg-mul-1N/A

      \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    3. unsub-negN/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. lower--.f32N/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. *-commutativeN/A

      \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. lower-*.f32N/A

      \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. lower-*.f3287.9

      \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  7. Applied rewrites87.9%

    \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  8. Final simplification87.9%

    \[\leadsto \frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}} \]
  9. Add Preprocessing

Alternative 10: 87.3% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \frac{u0 \cdot \left(1 - u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (* u0 (- 1.0 (* u0 -0.5)))
  (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return (u0 * (1.0f - (u0 * -0.5f))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    code = (u0 * (1.0e0 - (u0 * (-0.5e0)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(u0 * Float32(Float32(1.0) - Float32(u0 * Float32(-0.5)))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax))))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = (u0 * (single(1.0) - (u0 * single(-0.5)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
end
\begin{array}{l}

\\
\frac{u0 \cdot \left(1 - u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Derivation
  1. Initial program 61.1%

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Add Preprocessing
  3. Taylor expanded in u0 around 0

    \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  4. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. sub-negN/A

      \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    3. *-commutativeN/A

      \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. metadata-evalN/A

      \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. lower-fma.f3214.8

      \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  5. Applied rewrites14.7%

    \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  6. Step-by-step derivation
    1. lower-+.f32N/A

      \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(u0 \cdot \frac{-1}{2} + -1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. lower-*.f3287.7

      \[\leadsto \frac{-u0 \cdot \left(\color{blue}{u0 \cdot -0.5} + -1\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  7. Applied rewrites87.7%

    \[\leadsto \frac{-u0 \cdot \color{blue}{\left(u0 \cdot -0.5 + -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  8. Final simplification87.7%

    \[\leadsto \frac{u0 \cdot \left(1 - u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}} \]
  9. Add Preprocessing

Alternative 11: 75.7% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\ \;\;\;\;\frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot 0.5\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 6.999999885293207e-11)
   (/ (* (* alphax alphax) (+ u0 (* (* u0 u0) 0.5))) cos2phi)
   (* (* alphay alphay) (/ (- u0 (* -0.5 (* u0 u0))) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11f) {
		tmp = ((alphax * alphax) * (u0 + ((u0 * u0) * 0.5f))) / cos2phi;
	} else {
		tmp = (alphay * alphay) * ((u0 - (-0.5f * (u0 * u0))) / sin2phi);
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: tmp
    if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11) then
        tmp = ((alphax * alphax) * (u0 + ((u0 * u0) * 0.5e0))) / cos2phi
    else
        tmp = (alphay * alphay) * ((u0 - ((-0.5e0) * (u0 * u0))) / sin2phi)
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(6.999999885293207e-11))
		tmp = Float32(Float32(Float32(alphax * alphax) * Float32(u0 + Float32(Float32(u0 * u0) * Float32(0.5)))) / cos2phi);
	else
		tmp = Float32(Float32(alphay * alphay) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / sin2phi));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(6.999999885293207e-11))
		tmp = ((alphax * alphax) * (u0 + ((u0 * u0) * single(0.5)))) / cos2phi;
	else
		tmp = (alphay * alphay) * ((u0 - (single(-0.5) * (u0 * u0))) / sin2phi);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\
\;\;\;\;\frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot 0.5\right)}{cos2phi}\\

\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 6.99999989e-11

    1. Initial program 57.3%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f322.8

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites2.9%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3286.1

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites86.1%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Taylor expanded in cos2phi around inf

      \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{cos2phi}} \]
    9. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{cos2phi}} \]
      2. lower-*.f32N/A

        \[\leadsto \frac{\color{blue}{{alphax}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}}{cos2phi} \]
      3. unpow2N/A

        \[\leadsto \frac{\color{blue}{\left(alphax \cdot alphax\right)} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{cos2phi} \]
      4. lower-*.f32N/A

        \[\leadsto \frac{\color{blue}{\left(alphax \cdot alphax\right)} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{cos2phi} \]
      5. cancel-sign-sub-invN/A

        \[\leadsto \frac{\left(alphax \cdot alphax\right) \cdot \color{blue}{\left(u0 + \left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot {u0}^{2}\right)}}{cos2phi} \]
      6. metadata-evalN/A

        \[\leadsto \frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + \color{blue}{\frac{1}{2}} \cdot {u0}^{2}\right)}{cos2phi} \]
      7. lower-+.f32N/A

        \[\leadsto \frac{\left(alphax \cdot alphax\right) \cdot \color{blue}{\left(u0 + \frac{1}{2} \cdot {u0}^{2}\right)}}{cos2phi} \]
      8. lower-*.f32N/A

        \[\leadsto \frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + \color{blue}{\frac{1}{2} \cdot {u0}^{2}}\right)}{cos2phi} \]
      9. unpow2N/A

        \[\leadsto \frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + \frac{1}{2} \cdot \color{blue}{\left(u0 \cdot u0\right)}\right)}{cos2phi} \]
      10. lower-*.f3260.8

        \[\leadsto \frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + 0.5 \cdot \color{blue}{\left(u0 \cdot u0\right)}\right)}{cos2phi} \]
    10. Applied rewrites60.8%

      \[\leadsto \color{blue}{\frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + 0.5 \cdot \left(u0 \cdot u0\right)\right)}{cos2phi}} \]

    if 6.99999989e-11 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 62.6%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3219.5

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites19.5%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3288.6

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites88.6%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      3. lower-/.f3288.6

        \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{\frac{sin2phi}{alphay}}}{alphay}} \]
    9. Applied rewrites88.6%

      \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{sin2phi}} \]
    11. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      2. div-subN/A

        \[\leadsto {alphay}^{2} \cdot \color{blue}{\left(\frac{u0}{sin2phi} - \frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}\right)} \]
      3. associate-*r/N/A

        \[\leadsto {alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}}\right) \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right)} \]
      5. unpow2N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      6. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}}\right) \]
      8. div-subN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      9. lower-/.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      10. lower--.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{\color{blue}{u0 - \frac{-1}{2} \cdot {u0}^{2}}}{sin2phi} \]
      11. *-commutativeN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      12. lower-*.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      13. unpow2N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot \frac{-1}{2}}{sin2phi} \]
      14. lower-*.f3281.5

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot -0.5}{sin2phi} \]
    12. Applied rewrites81.5%

      \[\leadsto \color{blue}{\left(alphay \cdot alphay\right) \cdot \frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\ \;\;\;\;\frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot 0.5\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 75.7% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := u0 - -0.5 \cdot \left(u0 \cdot u0\right)\\ \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\ \;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{t\_0}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{t\_0}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (- u0 (* -0.5 (* u0 u0)))))
   (if (<= (/ sin2phi (* alphay alphay)) 6.999999885293207e-11)
     (* (* alphax alphax) (/ t_0 cos2phi))
     (* (* alphay alphay) (/ t_0 sin2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = u0 - (-0.5f * (u0 * u0));
	float tmp;
	if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11f) {
		tmp = (alphax * alphax) * (t_0 / cos2phi);
	} else {
		tmp = (alphay * alphay) * (t_0 / sin2phi);
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: t_0
    real(4) :: tmp
    t_0 = u0 - ((-0.5e0) * (u0 * u0))
    if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11) then
        tmp = (alphax * alphax) * (t_0 / cos2phi)
    else
        tmp = (alphay * alphay) * (t_0 / sin2phi)
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0)))
	tmp = Float32(0.0)
	if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(6.999999885293207e-11))
		tmp = Float32(Float32(alphax * alphax) * Float32(t_0 / cos2phi));
	else
		tmp = Float32(Float32(alphay * alphay) * Float32(t_0 / sin2phi));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = u0 - (single(-0.5) * (u0 * u0));
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(6.999999885293207e-11))
		tmp = (alphax * alphax) * (t_0 / cos2phi);
	else
		tmp = (alphay * alphay) * (t_0 / sin2phi);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := u0 - -0.5 \cdot \left(u0 \cdot u0\right)\\
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\
\;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{t\_0}{cos2phi}\\

\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{t\_0}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 6.99999989e-11

    1. Initial program 57.3%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f322.8

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites2.9%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3286.1

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites86.1%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      3. lower-/.f3286.0

        \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{\frac{sin2phi}{alphay}}}{alphay}} \]
    9. Applied rewrites86.0%

      \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Taylor expanded in cos2phi around inf

      \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{cos2phi}} \]
    11. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{{alphax}^{2} \cdot \frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{cos2phi}} \]
      2. div-subN/A

        \[\leadsto {alphax}^{2} \cdot \color{blue}{\left(\frac{u0}{cos2phi} - \frac{\frac{-1}{2} \cdot {u0}^{2}}{cos2phi}\right)} \]
      3. associate-*r/N/A

        \[\leadsto {alphax}^{2} \cdot \left(\frac{u0}{cos2phi} - \color{blue}{\frac{-1}{2} \cdot \frac{{u0}^{2}}{cos2phi}}\right) \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{{alphax}^{2} \cdot \left(\frac{u0}{cos2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{cos2phi}\right)} \]
      5. unpow2N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right)} \cdot \left(\frac{u0}{cos2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{cos2phi}\right) \]
      6. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right)} \cdot \left(\frac{u0}{cos2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{cos2phi}\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \left(\frac{u0}{cos2phi} - \color{blue}{\frac{\frac{-1}{2} \cdot {u0}^{2}}{cos2phi}}\right) \]
      8. div-subN/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{cos2phi}} \]
      9. lower-/.f32N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{cos2phi}} \]
      10. lower--.f32N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{\color{blue}{u0 - \frac{-1}{2} \cdot {u0}^{2}}}{cos2phi} \]
      11. *-commutativeN/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{cos2phi} \]
      12. lower-*.f32N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{cos2phi} \]
      13. unpow2N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot \frac{-1}{2}}{cos2phi} \]
      14. lower-*.f3260.8

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot -0.5}{cos2phi} \]
    12. Applied rewrites60.8%

      \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{cos2phi}} \]

    if 6.99999989e-11 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 62.6%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f3219.5

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites19.5%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3288.6

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites88.6%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      3. lower-/.f3288.6

        \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{\frac{sin2phi}{alphay}}}{alphay}} \]
    9. Applied rewrites88.6%

      \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{sin2phi}} \]
    11. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      2. div-subN/A

        \[\leadsto {alphay}^{2} \cdot \color{blue}{\left(\frac{u0}{sin2phi} - \frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}\right)} \]
      3. associate-*r/N/A

        \[\leadsto {alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}}\right) \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{{alphay}^{2} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right)} \]
      5. unpow2N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      6. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \left(\frac{u0}{sin2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{sin2phi}\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \left(\frac{u0}{sin2phi} - \color{blue}{\frac{\frac{-1}{2} \cdot {u0}^{2}}{sin2phi}}\right) \]
      8. div-subN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      9. lower-/.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{sin2phi}} \]
      10. lower--.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{\color{blue}{u0 - \frac{-1}{2} \cdot {u0}^{2}}}{sin2phi} \]
      11. *-commutativeN/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      12. lower-*.f32N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{sin2phi} \]
      13. unpow2N/A

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot \frac{-1}{2}}{sin2phi} \]
      14. lower-*.f3281.5

        \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot -0.5}{sin2phi} \]
    12. Applied rewrites81.5%

      \[\leadsto \color{blue}{\left(alphay \cdot alphay\right) \cdot \frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\ \;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 68.6% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\ \;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 4.999999858590343e-10)
   (* (* alphax alphax) (/ (- u0 (* -0.5 (* u0 u0))) cos2phi))
   (/ (* u0 (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10f) {
		tmp = (alphax * alphax) * ((u0 - (-0.5f * (u0 * u0))) / cos2phi);
	} else {
		tmp = (u0 * (alphay * alphay)) / sin2phi;
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: tmp
    if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10) then
        tmp = (alphax * alphax) * ((u0 - ((-0.5e0) * (u0 * u0))) / cos2phi)
    else
        tmp = (u0 * (alphay * alphay)) / sin2phi
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(4.999999858590343e-10))
		tmp = Float32(Float32(alphax * alphax) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / cos2phi));
	else
		tmp = Float32(Float32(u0 * Float32(alphay * alphay)) / sin2phi);
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(4.999999858590343e-10))
		tmp = (alphax * alphax) * ((u0 - (single(-0.5) * (u0 * u0))) / cos2phi);
	else
		tmp = (u0 * (alphay * alphay)) / sin2phi;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\
\;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{cos2phi}\\

\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 4.99999986e-10

    1. Initial program 56.8%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{u0 \cdot \left(\frac{-1}{2} \cdot u0 - 1\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot u0 + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(\color{blue}{u0 \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\mathsf{neg}\left(u0 \cdot \left(u0 \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. lower-fma.f322.9

        \[\leadsto \frac{-u0 \cdot \color{blue}{\mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Applied rewrites2.9%

      \[\leadsto \frac{-\color{blue}{u0 \cdot \mathsf{fma}\left(u0, -0.5, -1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    6. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + -1 \cdot u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 + \color{blue}{\left(\mathsf{neg}\left(u0\right)\right)}\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      3. unsub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      4. lower--.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\left(u0 \cdot \frac{-1}{2}\right) \cdot u0 - u0\right)}\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      6. lower-*.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\color{blue}{u0 \cdot \left(u0 \cdot \frac{-1}{2}\right)} - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. lower-*.f3286.5

        \[\leadsto \frac{-\left(u0 \cdot \color{blue}{\left(u0 \cdot -0.5\right)} - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    7. Applied rewrites86.5%

      \[\leadsto \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. lower-/.f32N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(u0 \cdot \left(u0 \cdot \frac{-1}{2}\right) - u0\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      3. lower-/.f3286.5

        \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{\frac{sin2phi}{alphay}}}{alphay}} \]
    9. Applied rewrites86.5%

      \[\leadsto \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Taylor expanded in cos2phi around inf

      \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot \left(u0 - \frac{-1}{2} \cdot {u0}^{2}\right)}{cos2phi}} \]
    11. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{{alphax}^{2} \cdot \frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{cos2phi}} \]
      2. div-subN/A

        \[\leadsto {alphax}^{2} \cdot \color{blue}{\left(\frac{u0}{cos2phi} - \frac{\frac{-1}{2} \cdot {u0}^{2}}{cos2phi}\right)} \]
      3. associate-*r/N/A

        \[\leadsto {alphax}^{2} \cdot \left(\frac{u0}{cos2phi} - \color{blue}{\frac{-1}{2} \cdot \frac{{u0}^{2}}{cos2phi}}\right) \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{{alphax}^{2} \cdot \left(\frac{u0}{cos2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{cos2phi}\right)} \]
      5. unpow2N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right)} \cdot \left(\frac{u0}{cos2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{cos2phi}\right) \]
      6. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right)} \cdot \left(\frac{u0}{cos2phi} - \frac{-1}{2} \cdot \frac{{u0}^{2}}{cos2phi}\right) \]
      7. associate-*r/N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \left(\frac{u0}{cos2phi} - \color{blue}{\frac{\frac{-1}{2} \cdot {u0}^{2}}{cos2phi}}\right) \]
      8. div-subN/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{cos2phi}} \]
      9. lower-/.f32N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \color{blue}{\frac{u0 - \frac{-1}{2} \cdot {u0}^{2}}{cos2phi}} \]
      10. lower--.f32N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{\color{blue}{u0 - \frac{-1}{2} \cdot {u0}^{2}}}{cos2phi} \]
      11. *-commutativeN/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{cos2phi} \]
      12. lower-*.f32N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{u0 - \color{blue}{{u0}^{2} \cdot \frac{-1}{2}}}{cos2phi} \]
      13. unpow2N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot \frac{-1}{2}}{cos2phi} \]
      14. lower-*.f3260.1

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \frac{u0 - \color{blue}{\left(u0 \cdot u0\right)} \cdot -0.5}{cos2phi} \]
    12. Applied rewrites60.1%

      \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{cos2phi}} \]

    if 4.99999986e-10 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 62.9%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3277.7

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites77.7%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    6. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
    7. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphay}^{2}}}{sin2phi} \]
      3. lower-*.f32N/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphay}^{2}}}{sin2phi} \]
      4. unpow2N/A

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphay \cdot alphay\right)}}{sin2phi} \]
      5. lower-*.f3272.8

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphay \cdot alphay\right)}}{sin2phi} \]
    8. Applied rewrites72.8%

      \[\leadsto \color{blue}{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\ \;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 66.3% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\ \;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 4.999999858590343e-10)
   (/ u0 (/ cos2phi (* alphax alphax)))
   (/ (* u0 (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10f) {
		tmp = u0 / (cos2phi / (alphax * alphax));
	} else {
		tmp = (u0 * (alphay * alphay)) / sin2phi;
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: tmp
    if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10) then
        tmp = u0 / (cos2phi / (alphax * alphax))
    else
        tmp = (u0 * (alphay * alphay)) / sin2phi
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(4.999999858590343e-10))
		tmp = Float32(u0 / Float32(cos2phi / Float32(alphax * alphax)));
	else
		tmp = Float32(Float32(u0 * Float32(alphay * alphay)) / sin2phi);
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(4.999999858590343e-10))
		tmp = u0 / (cos2phi / (alphax * alphax));
	else
		tmp = (u0 * (alphay * alphay)) / sin2phi;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}\\

\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 4.99999986e-10

    1. Initial program 56.8%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3273.9

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites73.9%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    6. Taylor expanded in cos2phi around inf

      \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}}} \]
    7. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}}} \]
      2. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}}} \]
      3. lower-*.f3251.9

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}}} \]
    8. Applied rewrites51.9%

      \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{alphax \cdot alphax}}} \]

    if 4.99999986e-10 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 62.9%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3277.7

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites77.7%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    6. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
    7. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphay}^{2}}}{sin2phi} \]
      3. lower-*.f32N/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphay}^{2}}}{sin2phi} \]
      4. unpow2N/A

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphay \cdot alphay\right)}}{sin2phi} \]
      5. lower-*.f3272.8

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphay \cdot alphay\right)}}{sin2phi} \]
    8. Applied rewrites72.8%

      \[\leadsto \color{blue}{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 66.3% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\ \;\;\;\;u0 \cdot \left(\left(alphax \cdot alphax\right) \cdot \frac{1}{cos2phi}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 4.999999858590343e-10)
   (* u0 (* (* alphax alphax) (/ 1.0 cos2phi)))
   (/ (* u0 (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10f) {
		tmp = u0 * ((alphax * alphax) * (1.0f / cos2phi));
	} else {
		tmp = (u0 * (alphay * alphay)) / sin2phi;
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: tmp
    if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10) then
        tmp = u0 * ((alphax * alphax) * (1.0e0 / cos2phi))
    else
        tmp = (u0 * (alphay * alphay)) / sin2phi
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(4.999999858590343e-10))
		tmp = Float32(u0 * Float32(Float32(alphax * alphax) * Float32(Float32(1.0) / cos2phi)));
	else
		tmp = Float32(Float32(u0 * Float32(alphay * alphay)) / sin2phi);
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(4.999999858590343e-10))
		tmp = u0 * ((alphax * alphax) * (single(1.0) / cos2phi));
	else
		tmp = (u0 * (alphay * alphay)) / sin2phi;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\
\;\;\;\;u0 \cdot \left(\left(alphax \cdot alphax\right) \cdot \frac{1}{cos2phi}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 4.99999986e-10

    1. Initial program 56.8%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3273.9

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites73.9%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    6. Taylor expanded in cos2phi around inf

      \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot u0}{cos2phi}} \]
    7. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot u0}{cos2phi}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphax}^{2}}}{cos2phi} \]
      3. lower-*.f32N/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphax}^{2}}}{cos2phi} \]
      4. unpow2N/A

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
      5. lower-*.f3251.9

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
    8. Applied rewrites51.9%

      \[\leadsto \color{blue}{\frac{u0 \cdot \left(alphax \cdot alphax\right)}{cos2phi}} \]
    9. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(alphax \cdot alphax\right) \cdot u0}}{cos2phi} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]
      5. lower-/.f3251.9

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \color{blue}{\frac{u0}{cos2phi}} \]
    10. Applied rewrites51.9%

      \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]
    11. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right)} \cdot \frac{u0}{cos2phi} \]
      2. lift-/.f32N/A

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \color{blue}{\frac{u0}{cos2phi}} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{u0}{cos2phi} \cdot \left(alphax \cdot alphax\right)} \]
      4. lift-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{cos2phi}} \cdot \left(alphax \cdot alphax\right) \]
      5. div-invN/A

        \[\leadsto \color{blue}{\left(u0 \cdot \frac{1}{cos2phi}\right)} \cdot \left(alphax \cdot alphax\right) \]
      6. associate-*l*N/A

        \[\leadsto \color{blue}{u0 \cdot \left(\frac{1}{cos2phi} \cdot \left(alphax \cdot alphax\right)\right)} \]
      7. lower-*.f32N/A

        \[\leadsto \color{blue}{u0 \cdot \left(\frac{1}{cos2phi} \cdot \left(alphax \cdot alphax\right)\right)} \]
      8. lower-*.f32N/A

        \[\leadsto u0 \cdot \color{blue}{\left(\frac{1}{cos2phi} \cdot \left(alphax \cdot alphax\right)\right)} \]
      9. lower-/.f3251.9

        \[\leadsto u0 \cdot \left(\color{blue}{\frac{1}{cos2phi}} \cdot \left(alphax \cdot alphax\right)\right) \]
    12. Applied rewrites51.9%

      \[\leadsto \color{blue}{u0 \cdot \left(\frac{1}{cos2phi} \cdot \left(alphax \cdot alphax\right)\right)} \]

    if 4.99999986e-10 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 62.9%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3277.7

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites77.7%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    6. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
    7. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphay}^{2}}}{sin2phi} \]
      3. lower-*.f32N/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphay}^{2}}}{sin2phi} \]
      4. unpow2N/A

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphay \cdot alphay\right)}}{sin2phi} \]
      5. lower-*.f3272.8

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphay \cdot alphay\right)}}{sin2phi} \]
    8. Applied rewrites72.8%

      \[\leadsto \color{blue}{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\ \;\;\;\;u0 \cdot \left(\left(alphax \cdot alphax\right) \cdot \frac{1}{cos2phi}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 66.3% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\ \;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 4.999999858590343e-10)
   (* (* alphax alphax) (/ u0 cos2phi))
   (/ (* u0 (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10f) {
		tmp = (alphax * alphax) * (u0 / cos2phi);
	} else {
		tmp = (u0 * (alphay * alphay)) / sin2phi;
	}
	return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    real(4) :: tmp
    if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10) then
        tmp = (alphax * alphax) * (u0 / cos2phi)
    else
        tmp = (u0 * (alphay * alphay)) / sin2phi
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(4.999999858590343e-10))
		tmp = Float32(Float32(alphax * alphax) * Float32(u0 / cos2phi));
	else
		tmp = Float32(Float32(u0 * Float32(alphay * alphay)) / sin2phi);
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(4.999999858590343e-10))
		tmp = (alphax * alphax) * (u0 / cos2phi);
	else
		tmp = (u0 * (alphay * alphay)) / sin2phi;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\
\;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}\\

\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 sin2phi (*.f32 alphay alphay)) < 4.99999986e-10

    1. Initial program 56.8%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3273.9

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites73.9%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    6. Taylor expanded in cos2phi around inf

      \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot u0}{cos2phi}} \]
    7. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot u0}{cos2phi}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphax}^{2}}}{cos2phi} \]
      3. lower-*.f32N/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphax}^{2}}}{cos2phi} \]
      4. unpow2N/A

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
      5. lower-*.f3251.9

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
    8. Applied rewrites51.9%

      \[\leadsto \color{blue}{\frac{u0 \cdot \left(alphax \cdot alphax\right)}{cos2phi}} \]
    9. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(alphax \cdot alphax\right) \cdot u0}}{cos2phi} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]
      4. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]
      5. lower-/.f3251.9

        \[\leadsto \left(alphax \cdot alphax\right) \cdot \color{blue}{\frac{u0}{cos2phi}} \]
    10. Applied rewrites51.9%

      \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]

    if 4.99999986e-10 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 62.9%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      2. lower-+.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
      3. lower-/.f32N/A

        \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      5. lower-*.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      6. lower-/.f32N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
      7. unpow2N/A

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
      8. lower-*.f3277.7

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    5. Applied rewrites77.7%

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    6. Taylor expanded in cos2phi around 0

      \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
    7. Step-by-step derivation
      1. lower-/.f32N/A

        \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphay}^{2}}}{sin2phi} \]
      3. lower-*.f32N/A

        \[\leadsto \frac{\color{blue}{u0 \cdot {alphay}^{2}}}{sin2phi} \]
      4. unpow2N/A

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphay \cdot alphay\right)}}{sin2phi} \]
      5. lower-*.f3272.8

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphay \cdot alphay\right)}}{sin2phi} \]
    8. Applied rewrites72.8%

      \[\leadsto \color{blue}{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 17: 23.7% accurate, 6.9× speedup?

\[\begin{array}{l} \\ \left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (* (* alphax alphax) (/ u0 cos2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return (alphax * alphax) * (u0 / cos2phi);
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
    real(4), intent (in) :: alphax
    real(4), intent (in) :: alphay
    real(4), intent (in) :: u0
    real(4), intent (in) :: cos2phi
    real(4), intent (in) :: sin2phi
    code = (alphax * alphax) * (u0 / cos2phi)
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(alphax * alphax) * Float32(u0 / cos2phi))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = (alphax * alphax) * (u0 / cos2phi);
end
\begin{array}{l}

\\
\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}
\end{array}
Derivation
  1. Initial program 61.1%

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Add Preprocessing
  3. Taylor expanded in u0 around 0

    \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
  4. Step-by-step derivation
    1. lower-/.f32N/A

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    2. lower-+.f32N/A

      \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    3. lower-/.f32N/A

      \[\leadsto \frac{u0}{\color{blue}{\frac{cos2phi}{{alphax}^{2}}} + \frac{sin2phi}{{alphay}^{2}}} \]
    4. unpow2N/A

      \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
    5. lower-*.f32N/A

      \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
    6. lower-/.f32N/A

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{{alphay}^{2}}}} \]
    7. unpow2N/A

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    8. lower-*.f3276.6

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
  5. Applied rewrites76.6%

    \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
  6. Taylor expanded in cos2phi around inf

    \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot u0}{cos2phi}} \]
  7. Step-by-step derivation
    1. lower-/.f32N/A

      \[\leadsto \color{blue}{\frac{{alphax}^{2} \cdot u0}{cos2phi}} \]
    2. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{u0 \cdot {alphax}^{2}}}{cos2phi} \]
    3. lower-*.f32N/A

      \[\leadsto \frac{\color{blue}{u0 \cdot {alphax}^{2}}}{cos2phi} \]
    4. unpow2N/A

      \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
    5. lower-*.f3223.4

      \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
  8. Applied rewrites23.4%

    \[\leadsto \color{blue}{\frac{u0 \cdot \left(alphax \cdot alphax\right)}{cos2phi}} \]
  9. Step-by-step derivation
    1. lift-*.f32N/A

      \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
    2. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{\left(alphax \cdot alphax\right) \cdot u0}}{cos2phi} \]
    3. associate-/l*N/A

      \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]
    4. lower-*.f32N/A

      \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]
    5. lower-/.f3223.4

      \[\leadsto \left(alphax \cdot alphax\right) \cdot \color{blue}{\frac{u0}{cos2phi}} \]
  10. Applied rewrites23.4%

    \[\leadsto \color{blue}{\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}} \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2024216 
(FPCore (alphax alphay u0 cos2phi sin2phi)
  :name "Beckmann Distribution sample, tan2theta, alphax != alphay, u1 <= 0.5"
  :precision binary32
  :pre (and (and (and (and (and (<= 0.0001 alphax) (<= alphax 1.0)) (and (<= 0.0001 alphay) (<= alphay 1.0))) (and (<= 2.328306437e-10 u0) (<= u0 1.0))) (and (<= 0.0 cos2phi) (<= cos2phi 1.0))) (<= 0.0 sin2phi))
  (/ (- (log (- 1.0 u0))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))