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

Percentage Accurate: 60.6% → 98.3%
Time: 13.6s
Alternatives: 8
Speedup: 8.9×

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 8 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: 60.6% 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: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (- (log1p (- u0)))
  (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return -log1pf(-u0) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
}
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(-log1p(Float32(-u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay))))
end
\begin{array}{l}

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

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Step-by-step derivation
    1. sub-neg61.6%

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

      \[\leadsto \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Simplified98.8%

    \[\leadsto \color{blue}{\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
  4. Final simplification98.8%

    \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]

Alternative 2: 82.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - u0 \leq 0.9994999766349792:\\ \;\;\;\;\frac{\left(alphay \cdot alphay\right) \cdot \left(-\log \left(1 - u0\right)\right)}{sin2phi}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + sin2phi \cdot {alphay}^{-2}}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (- 1.0 u0) 0.9994999766349792)
   (/ (* (* alphay alphay) (- (log (- 1.0 u0)))) sin2phi)
   (/ u0 (+ (/ cos2phi (* alphax alphax)) (* sin2phi (pow alphay -2.0))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((1.0f - u0) <= 0.9994999766349792f) {
		tmp = ((alphay * alphay) * -logf((1.0f - u0))) / sin2phi;
	} else {
		tmp = u0 / ((cos2phi / (alphax * alphax)) + (sin2phi * powf(alphay, -2.0f)));
	}
	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 ((1.0e0 - u0) <= 0.9994999766349792e0) then
        tmp = ((alphay * alphay) * -log((1.0e0 - u0))) / sin2phi
    else
        tmp = u0 / ((cos2phi / (alphax * alphax)) + (sin2phi * (alphay ** (-2.0e0))))
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - u0) <= Float32(0.9994999766349792))
		tmp = Float32(Float32(Float32(alphay * alphay) * Float32(-log(Float32(Float32(1.0) - u0)))) / sin2phi);
	else
		tmp = Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi * (alphay ^ Float32(-2.0)))));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((single(1.0) - u0) <= single(0.9994999766349792))
		tmp = ((alphay * alphay) * -log((single(1.0) - u0))) / sin2phi;
	else
		tmp = u0 / ((cos2phi / (alphax * alphax)) + (sin2phi * (alphay ^ single(-2.0))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;1 - u0 \leq 0.9994999766349792:\\
\;\;\;\;\frac{\left(alphay \cdot alphay\right) \cdot \left(-\log \left(1 - u0\right)\right)}{sin2phi}\\

\mathbf{else}:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + sin2phi \cdot {alphay}^{-2}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 1 u0) < 0.999499977

    1. Initial program 90.4%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Step-by-step derivation
      1. associate-/r*90.4%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{{alphay}^{2} \cdot \log \left(1 - u0\right)}{sin2phi}} \]
    5. Step-by-step derivation
      1. unpow238.5%

        \[\leadsto \frac{\color{blue}{alphay \cdot alphay}}{\frac{sin2phi}{u0}} \]
    6. Applied egg-rr65.5%

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

    if 0.999499977 < (-.f32 1 u0)

    1. Initial program 46.5%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Step-by-step derivation
      1. associate-/r*46.5%

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

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

      \[\leadsto \frac{-\color{blue}{-1 \cdot u0}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
    5. Step-by-step derivation
      1. mul-1-neg90.4%

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

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

        \[\leadsto \frac{-\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{alphay \cdot alphay}}} \]
      2. clear-num90.5%

        \[\leadsto \frac{-\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{1}{\frac{alphay \cdot alphay}{sin2phi}}}} \]
      3. associate-/r/90.5%

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

        \[\leadsto \frac{-\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{1}{\color{blue}{{alphay}^{2}}} \cdot sin2phi} \]
      5. pow-flip90.6%

        \[\leadsto \frac{-\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{{alphay}^{\left(-2\right)}} \cdot sin2phi} \]
      6. metadata-eval90.6%

        \[\leadsto \frac{-\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + {alphay}^{\color{blue}{-2}} \cdot sin2phi} \]
    8. Applied egg-rr90.6%

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

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

Alternative 3: 82.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - u0 \leq 0.9994999766349792:\\ \;\;\;\;\frac{\left(alphay \cdot alphay\right) \cdot \left(-\log \left(1 - u0\right)\right)}{sin2phi}\\ \mathbf{else}:\\ \;\;\;\;\frac{alphax \cdot \left(\left(-u0\right) \cdot alphay\right)}{sin2phi \cdot \frac{-alphax}{alphay} - cos2phi \cdot \frac{alphay}{alphax}}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (- 1.0 u0) 0.9994999766349792)
   (/ (* (* alphay alphay) (- (log (- 1.0 u0)))) sin2phi)
   (/
    (* alphax (* (- u0) alphay))
    (- (* sin2phi (/ (- alphax) alphay)) (* cos2phi (/ alphay alphax))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float tmp;
	if ((1.0f - u0) <= 0.9994999766349792f) {
		tmp = ((alphay * alphay) * -logf((1.0f - u0))) / sin2phi;
	} else {
		tmp = (alphax * (-u0 * alphay)) / ((sin2phi * (-alphax / alphay)) - (cos2phi * (alphay / 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) :: tmp
    if ((1.0e0 - u0) <= 0.9994999766349792e0) then
        tmp = ((alphay * alphay) * -log((1.0e0 - u0))) / sin2phi
    else
        tmp = (alphax * (-u0 * alphay)) / ((sin2phi * (-alphax / alphay)) - (cos2phi * (alphay / alphax)))
    end if
    code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - u0) <= Float32(0.9994999766349792))
		tmp = Float32(Float32(Float32(alphay * alphay) * Float32(-log(Float32(Float32(1.0) - u0)))) / sin2phi);
	else
		tmp = Float32(Float32(alphax * Float32(Float32(-u0) * alphay)) / Float32(Float32(sin2phi * Float32(Float32(-alphax) / alphay)) - Float32(cos2phi * Float32(alphay / alphax))));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((single(1.0) - u0) <= single(0.9994999766349792))
		tmp = ((alphay * alphay) * -log((single(1.0) - u0))) / sin2phi;
	else
		tmp = (alphax * (-u0 * alphay)) / ((sin2phi * (-alphax / alphay)) - (cos2phi * (alphay / alphax)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;1 - u0 \leq 0.9994999766349792:\\
\;\;\;\;\frac{\left(alphay \cdot alphay\right) \cdot \left(-\log \left(1 - u0\right)\right)}{sin2phi}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 1 u0) < 0.999499977

    1. Initial program 90.4%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Step-by-step derivation
      1. associate-/r*90.4%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{{alphay}^{2} \cdot \log \left(1 - u0\right)}{sin2phi}} \]
    5. Step-by-step derivation
      1. unpow238.5%

        \[\leadsto \frac{\color{blue}{alphay \cdot alphay}}{\frac{sin2phi}{u0}} \]
    6. Applied egg-rr65.5%

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

    if 0.999499977 < (-.f32 1 u0)

    1. Initial program 46.5%

      \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    2. Step-by-step derivation
      1. sub-neg46.5%

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

        \[\leadsto \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    4. Step-by-step derivation
      1. associate-/r*98.8%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. associate-/r*98.8%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
      3. frac-2neg98.8%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \color{blue}{\frac{-\frac{sin2phi}{alphay}}{-alphay}}} \]
      4. frac-add98.6%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \left(-\frac{sin2phi}{alphay}\right)}{alphax \cdot \left(-alphay\right)}}} \]
      5. distribute-neg-frac98.6%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \color{blue}{\frac{-sin2phi}{alphay}}}{alphax \cdot \left(-alphay\right)}} \]
    5. Applied egg-rr98.6%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \frac{-sin2phi}{alphay}}{alphax \cdot \left(-alphay\right)}}} \]
    6. Step-by-step derivation
      1. +-commutative98.6%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{alphax \cdot \frac{-sin2phi}{alphay} + \frac{cos2phi}{alphax} \cdot \left(-alphay\right)}}{alphax \cdot \left(-alphay\right)}} \]
      2. *-commutative98.6%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{alphax \cdot \frac{-sin2phi}{alphay} + \color{blue}{\left(-alphay\right) \cdot \frac{cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
      3. distribute-lft-neg-out98.6%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{alphax \cdot \frac{-sin2phi}{alphay} + \color{blue}{\left(-alphay \cdot \frac{cos2phi}{alphax}\right)}}{alphax \cdot \left(-alphay\right)}} \]
      4. unsub-neg98.6%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{alphax \cdot \frac{-sin2phi}{alphay} - alphay \cdot \frac{cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
      5. associate-*r/98.5%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{\frac{alphax \cdot \left(-sin2phi\right)}{alphay}} - alphay \cdot \frac{cos2phi}{alphax}}{alphax \cdot \left(-alphay\right)}} \]
      6. associate-/l*98.5%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{\frac{alphax}{\frac{alphay}{-sin2phi}}} - alphay \cdot \frac{cos2phi}{alphax}}{alphax \cdot \left(-alphay\right)}} \]
      7. associate-*r/98.6%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \color{blue}{\frac{alphay \cdot cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
      8. associate-/l*98.6%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \color{blue}{\frac{alphay}{\frac{alphax}{cos2phi}}}}{alphax \cdot \left(-alphay\right)}} \]
    7. Simplified98.6%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}}} \]
    8. Step-by-step derivation
      1. div-inv98.2%

        \[\leadsto \color{blue}{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}}} \]
      2. associate-/r/98.3%

        \[\leadsto \left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\color{blue}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right)} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}} \]
      3. associate-/r/98.3%

        \[\leadsto \left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \color{blue}{\frac{alphay}{alphax} \cdot cos2phi}}{alphax \cdot \left(-alphay\right)}} \]
    9. Applied egg-rr98.3%

      \[\leadsto \color{blue}{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \frac{alphay}{alphax} \cdot cos2phi}{alphax \cdot \left(-alphay\right)}}} \]
    10. Taylor expanded in u0 around 0 90.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{alphax \cdot \left(alphay \cdot u0\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
    11. Step-by-step derivation
      1. associate-*r/90.5%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(alphax \cdot \left(alphay \cdot u0\right)\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
      2. associate-*r*90.3%

        \[\leadsto \frac{-1 \cdot \color{blue}{\left(\left(alphax \cdot alphay\right) \cdot u0\right)}}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
      3. associate-*r*90.3%

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot \left(alphax \cdot alphay\right)\right) \cdot u0}}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
      4. neg-mul-190.3%

        \[\leadsto \frac{\color{blue}{\left(-alphax \cdot alphay\right)} \cdot u0}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
      5. *-commutative90.3%

        \[\leadsto \frac{\left(-\color{blue}{alphay \cdot alphax}\right) \cdot u0}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
      6. distribute-rgt-neg-in90.3%

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

        \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\color{blue}{\left(-\frac{alphax \cdot sin2phi}{alphay}\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
      8. associate-*l/90.5%

        \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\left(-\color{blue}{\frac{alphax}{alphay} \cdot sin2phi}\right) - \frac{alphay \cdot cos2phi}{alphax}} \]
      9. distribute-rgt-neg-out90.5%

        \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\color{blue}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
      10. *-commutative90.5%

        \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \frac{\color{blue}{cos2phi \cdot alphay}}{alphax}} \]
      11. associate-*r/90.4%

        \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \color{blue}{cos2phi \cdot \frac{alphay}{alphax}}} \]
    12. Simplified90.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{alphax \cdot \left(alphay \cdot u0\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
    14. Step-by-step derivation
      1. associate-*r/90.5%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(alphax \cdot \left(alphay \cdot u0\right)\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
      2. associate-*r*90.5%

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot alphax\right) \cdot \left(alphay \cdot u0\right)}}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
      3. neg-mul-190.5%

        \[\leadsto \frac{\color{blue}{\left(-alphax\right)} \cdot \left(alphay \cdot u0\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
      4. *-commutative90.5%

        \[\leadsto \frac{\left(-alphax\right) \cdot \color{blue}{\left(u0 \cdot alphay\right)}}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
      5. associate-*l/90.6%

        \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{-1 \cdot \color{blue}{\left(\frac{alphax}{alphay} \cdot sin2phi\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
      6. neg-mul-190.6%

        \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{\color{blue}{\left(-\frac{alphax}{alphay} \cdot sin2phi\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
      7. distribute-rgt-neg-in90.6%

        \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{\color{blue}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
      8. *-commutative90.6%

        \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \frac{\color{blue}{cos2phi \cdot alphay}}{alphax}} \]
      9. associate-*r/90.6%

        \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \color{blue}{cos2phi \cdot \frac{alphay}{alphax}}} \]
    15. Simplified90.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - u0 \leq 0.9994999766349792:\\ \;\;\;\;\frac{\left(alphay \cdot alphay\right) \cdot \left(-\log \left(1 - u0\right)\right)}{sin2phi}\\ \mathbf{else}:\\ \;\;\;\;\frac{alphax \cdot \left(\left(-u0\right) \cdot alphay\right)}{sin2phi \cdot \frac{-alphax}{alphay} - cos2phi \cdot \frac{alphay}{alphax}}\\ \end{array} \]

Alternative 4: 76.0% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \frac{alphax \cdot \left(\left(-u0\right) \cdot alphay\right)}{\frac{-alphax}{\frac{alphay}{sin2phi}} - cos2phi \cdot \frac{alphay}{alphax}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (* alphax (* (- u0) alphay))
  (- (/ (- alphax) (/ alphay sin2phi)) (* cos2phi (/ alphay alphax)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return (alphax * (-u0 * alphay)) / ((-alphax / (alphay / sin2phi)) - (cos2phi * (alphay / 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 = (alphax * (-u0 * alphay)) / ((-alphax / (alphay / sin2phi)) - (cos2phi * (alphay / alphax)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(alphax * Float32(Float32(-u0) * alphay)) / Float32(Float32(Float32(-alphax) / Float32(alphay / sin2phi)) - Float32(cos2phi * Float32(alphay / alphax))))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = (alphax * (-u0 * alphay)) / ((-alphax / (alphay / sin2phi)) - (cos2phi * (alphay / alphax)));
end
\begin{array}{l}

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

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Step-by-step derivation
    1. sub-neg61.6%

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

      \[\leadsto \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Simplified98.8%

    \[\leadsto \color{blue}{\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
  4. Step-by-step derivation
    1. associate-/r*98.7%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    2. associate-/r*98.6%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
    3. frac-2neg98.6%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \color{blue}{\frac{-\frac{sin2phi}{alphay}}{-alphay}}} \]
    4. frac-add98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \left(-\frac{sin2phi}{alphay}\right)}{alphax \cdot \left(-alphay\right)}}} \]
    5. distribute-neg-frac98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \color{blue}{\frac{-sin2phi}{alphay}}}{alphax \cdot \left(-alphay\right)}} \]
  5. Applied egg-rr98.4%

    \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \frac{-sin2phi}{alphay}}{alphax \cdot \left(-alphay\right)}}} \]
  6. Step-by-step derivation
    1. +-commutative98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{alphax \cdot \frac{-sin2phi}{alphay} + \frac{cos2phi}{alphax} \cdot \left(-alphay\right)}}{alphax \cdot \left(-alphay\right)}} \]
    2. *-commutative98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{alphax \cdot \frac{-sin2phi}{alphay} + \color{blue}{\left(-alphay\right) \cdot \frac{cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
    3. distribute-lft-neg-out98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{alphax \cdot \frac{-sin2phi}{alphay} + \color{blue}{\left(-alphay \cdot \frac{cos2phi}{alphax}\right)}}{alphax \cdot \left(-alphay\right)}} \]
    4. unsub-neg98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{alphax \cdot \frac{-sin2phi}{alphay} - alphay \cdot \frac{cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
    5. associate-*r/98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{\frac{alphax \cdot \left(-sin2phi\right)}{alphay}} - alphay \cdot \frac{cos2phi}{alphax}}{alphax \cdot \left(-alphay\right)}} \]
    6. associate-/l*98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{\frac{alphax}{\frac{alphay}{-sin2phi}}} - alphay \cdot \frac{cos2phi}{alphax}}{alphax \cdot \left(-alphay\right)}} \]
    7. associate-*r/98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \color{blue}{\frac{alphay \cdot cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
    8. associate-/l*98.5%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \color{blue}{\frac{alphay}{\frac{alphax}{cos2phi}}}}{alphax \cdot \left(-alphay\right)}} \]
  7. Simplified98.5%

    \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}}} \]
  8. Step-by-step derivation
    1. div-inv98.2%

      \[\leadsto \color{blue}{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}}} \]
    2. associate-/r/98.3%

      \[\leadsto \left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\color{blue}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right)} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}} \]
    3. associate-/r/98.2%

      \[\leadsto \left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \color{blue}{\frac{alphay}{alphax} \cdot cos2phi}}{alphax \cdot \left(-alphay\right)}} \]
  9. Applied egg-rr98.2%

    \[\leadsto \color{blue}{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \frac{alphay}{alphax} \cdot cos2phi}{alphax \cdot \left(-alphay\right)}}} \]
  10. Taylor expanded in u0 around 0 75.8%

    \[\leadsto \color{blue}{-1 \cdot \frac{alphax \cdot \left(alphay \cdot u0\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
  11. Step-by-step derivation
    1. mul-1-neg75.8%

      \[\leadsto \color{blue}{-\frac{alphax \cdot \left(alphay \cdot u0\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
    2. mul-1-neg75.8%

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

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

      \[\leadsto -\frac{alphax \cdot \left(alphay \cdot u0\right)}{\left(-\frac{alphax}{\frac{alphay}{sin2phi}}\right) - \frac{\color{blue}{cos2phi \cdot alphay}}{alphax}} \]
    5. associate-*r/75.9%

      \[\leadsto -\frac{alphax \cdot \left(alphay \cdot u0\right)}{\left(-\frac{alphax}{\frac{alphay}{sin2phi}}\right) - \color{blue}{cos2phi \cdot \frac{alphay}{alphax}}} \]
  12. Simplified75.9%

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

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

Alternative 5: 76.0% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \frac{alphax \cdot \left(\left(-u0\right) \cdot alphay\right)}{sin2phi \cdot \frac{-alphax}{alphay} - cos2phi \cdot \frac{alphay}{alphax}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (* alphax (* (- u0) alphay))
  (- (* sin2phi (/ (- alphax) alphay)) (* cos2phi (/ alphay alphax)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return (alphax * (-u0 * alphay)) / ((sin2phi * (-alphax / alphay)) - (cos2phi * (alphay / 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 = (alphax * (-u0 * alphay)) / ((sin2phi * (-alphax / alphay)) - (cos2phi * (alphay / alphax)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(alphax * Float32(Float32(-u0) * alphay)) / Float32(Float32(sin2phi * Float32(Float32(-alphax) / alphay)) - Float32(cos2phi * Float32(alphay / alphax))))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = (alphax * (-u0 * alphay)) / ((sin2phi * (-alphax / alphay)) - (cos2phi * (alphay / alphax)));
end
\begin{array}{l}

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

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Step-by-step derivation
    1. sub-neg61.6%

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

      \[\leadsto \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Simplified98.8%

    \[\leadsto \color{blue}{\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
  4. Step-by-step derivation
    1. associate-/r*98.7%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    2. associate-/r*98.6%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
    3. frac-2neg98.6%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \color{blue}{\frac{-\frac{sin2phi}{alphay}}{-alphay}}} \]
    4. frac-add98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \left(-\frac{sin2phi}{alphay}\right)}{alphax \cdot \left(-alphay\right)}}} \]
    5. distribute-neg-frac98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \color{blue}{\frac{-sin2phi}{alphay}}}{alphax \cdot \left(-alphay\right)}} \]
  5. Applied egg-rr98.4%

    \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax} \cdot \left(-alphay\right) + alphax \cdot \frac{-sin2phi}{alphay}}{alphax \cdot \left(-alphay\right)}}} \]
  6. Step-by-step derivation
    1. +-commutative98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{alphax \cdot \frac{-sin2phi}{alphay} + \frac{cos2phi}{alphax} \cdot \left(-alphay\right)}}{alphax \cdot \left(-alphay\right)}} \]
    2. *-commutative98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{alphax \cdot \frac{-sin2phi}{alphay} + \color{blue}{\left(-alphay\right) \cdot \frac{cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
    3. distribute-lft-neg-out98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{alphax \cdot \frac{-sin2phi}{alphay} + \color{blue}{\left(-alphay \cdot \frac{cos2phi}{alphax}\right)}}{alphax \cdot \left(-alphay\right)}} \]
    4. unsub-neg98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{alphax \cdot \frac{-sin2phi}{alphay} - alphay \cdot \frac{cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
    5. associate-*r/98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{\frac{alphax \cdot \left(-sin2phi\right)}{alphay}} - alphay \cdot \frac{cos2phi}{alphax}}{alphax \cdot \left(-alphay\right)}} \]
    6. associate-/l*98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\color{blue}{\frac{alphax}{\frac{alphay}{-sin2phi}}} - alphay \cdot \frac{cos2phi}{alphax}}{alphax \cdot \left(-alphay\right)}} \]
    7. associate-*r/98.4%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \color{blue}{\frac{alphay \cdot cos2phi}{alphax}}}{alphax \cdot \left(-alphay\right)}} \]
    8. associate-/l*98.5%

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \color{blue}{\frac{alphay}{\frac{alphax}{cos2phi}}}}{alphax \cdot \left(-alphay\right)}} \]
  7. Simplified98.5%

    \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}}} \]
  8. Step-by-step derivation
    1. div-inv98.2%

      \[\leadsto \color{blue}{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{\frac{alphay}{-sin2phi}} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}}} \]
    2. associate-/r/98.3%

      \[\leadsto \left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\color{blue}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right)} - \frac{alphay}{\frac{alphax}{cos2phi}}}{alphax \cdot \left(-alphay\right)}} \]
    3. associate-/r/98.2%

      \[\leadsto \left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \color{blue}{\frac{alphay}{alphax} \cdot cos2phi}}{alphax \cdot \left(-alphay\right)}} \]
  9. Applied egg-rr98.2%

    \[\leadsto \color{blue}{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{1}{\frac{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \frac{alphay}{alphax} \cdot cos2phi}{alphax \cdot \left(-alphay\right)}}} \]
  10. Taylor expanded in u0 around 0 75.8%

    \[\leadsto \color{blue}{-1 \cdot \frac{alphax \cdot \left(alphay \cdot u0\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
  11. Step-by-step derivation
    1. associate-*r/75.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(alphax \cdot \left(alphay \cdot u0\right)\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
    2. associate-*r*75.7%

      \[\leadsto \frac{-1 \cdot \color{blue}{\left(\left(alphax \cdot alphay\right) \cdot u0\right)}}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
    3. associate-*r*75.7%

      \[\leadsto \frac{\color{blue}{\left(-1 \cdot \left(alphax \cdot alphay\right)\right) \cdot u0}}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
    4. neg-mul-175.7%

      \[\leadsto \frac{\color{blue}{\left(-alphax \cdot alphay\right)} \cdot u0}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
    5. *-commutative75.7%

      \[\leadsto \frac{\left(-\color{blue}{alphay \cdot alphax}\right) \cdot u0}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
    6. distribute-rgt-neg-in75.7%

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

      \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\color{blue}{\left(-\frac{alphax \cdot sin2phi}{alphay}\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
    8. associate-*l/75.8%

      \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\left(-\color{blue}{\frac{alphax}{alphay} \cdot sin2phi}\right) - \frac{alphay \cdot cos2phi}{alphax}} \]
    9. distribute-rgt-neg-out75.8%

      \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\color{blue}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
    10. *-commutative75.8%

      \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \frac{\color{blue}{cos2phi \cdot alphay}}{alphax}} \]
    11. associate-*r/75.8%

      \[\leadsto \frac{\left(alphay \cdot \left(-alphax\right)\right) \cdot u0}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \color{blue}{cos2phi \cdot \frac{alphay}{alphax}}} \]
  12. Simplified75.8%

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

    \[\leadsto \color{blue}{-1 \cdot \frac{alphax \cdot \left(alphay \cdot u0\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
  14. Step-by-step derivation
    1. associate-*r/75.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(alphax \cdot \left(alphay \cdot u0\right)\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}}} \]
    2. associate-*r*75.8%

      \[\leadsto \frac{\color{blue}{\left(-1 \cdot alphax\right) \cdot \left(alphay \cdot u0\right)}}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
    3. neg-mul-175.8%

      \[\leadsto \frac{\color{blue}{\left(-alphax\right)} \cdot \left(alphay \cdot u0\right)}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
    4. *-commutative75.8%

      \[\leadsto \frac{\left(-alphax\right) \cdot \color{blue}{\left(u0 \cdot alphay\right)}}{-1 \cdot \frac{alphax \cdot sin2phi}{alphay} - \frac{alphay \cdot cos2phi}{alphax}} \]
    5. associate-*l/75.9%

      \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{-1 \cdot \color{blue}{\left(\frac{alphax}{alphay} \cdot sin2phi\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
    6. neg-mul-175.9%

      \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{\color{blue}{\left(-\frac{alphax}{alphay} \cdot sin2phi\right)} - \frac{alphay \cdot cos2phi}{alphax}} \]
    7. distribute-rgt-neg-in75.9%

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

      \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \frac{\color{blue}{cos2phi \cdot alphay}}{alphax}} \]
    9. associate-*r/75.9%

      \[\leadsto \frac{\left(-alphax\right) \cdot \left(u0 \cdot alphay\right)}{\frac{alphax}{alphay} \cdot \left(-sin2phi\right) - \color{blue}{cos2phi \cdot \frac{alphay}{alphax}}} \]
  15. Simplified75.9%

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

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

Alternative 6: 75.8% accurate, 7.7× speedup?

\[\begin{array}{l} \\ \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay} \cdot \frac{1}{alphay}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  u0
  (+ (/ cos2phi (* alphax alphax)) (* (/ sin2phi alphay) (/ 1.0 alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) * (1.0f / 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 = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) * (1.0e0 / alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) * Float32(Float32(1.0) / alphay))))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) * (single(1.0) / alphay)));
end
\begin{array}{l}

\\
\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay} \cdot \frac{1}{alphay}}
\end{array}
Derivation
  1. Initial program 61.6%

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Step-by-step derivation
    1. associate-/r*61.6%

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

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

    \[\leadsto \frac{-\color{blue}{-1 \cdot u0}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
  5. Step-by-step derivation
    1. mul-1-neg75.7%

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

    \[\leadsto \frac{-\color{blue}{\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
  7. Step-by-step derivation
    1. div-inv75.7%

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

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

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

Alternative 7: 75.8% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/ u0 (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return 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 = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay)))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay));
end
\begin{array}{l}

\\
\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Derivation
  1. Initial program 61.6%

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Step-by-step derivation
    1. associate-/r*61.6%

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

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

    \[\leadsto \frac{-\color{blue}{-1 \cdot u0}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
  5. Step-by-step derivation
    1. mul-1-neg75.7%

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

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

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

Alternative 8: 58.4% accurate, 16.6× speedup?

\[\begin{array}{l} \\ \frac{alphay \cdot alphay}{\frac{sin2phi}{u0}} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/ (* alphay alphay) (/ sin2phi u0)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return (alphay * alphay) / (sin2phi / u0);
}
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 = (alphay * alphay) / (sin2phi / u0)
end function
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(alphay * alphay) / Float32(sin2phi / u0))
end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = (alphay * alphay) / (sin2phi / u0);
end
\begin{array}{l}

\\
\frac{alphay \cdot alphay}{\frac{sin2phi}{u0}}
\end{array}
Derivation
  1. Initial program 61.6%

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Step-by-step derivation
    1. associate-/r*61.6%

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

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

    \[\leadsto \frac{-\color{blue}{-1 \cdot u0}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
  5. Step-by-step derivation
    1. mul-1-neg75.7%

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

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

    \[\leadsto \color{blue}{\frac{{alphay}^{2} \cdot u0}{sin2phi}} \]
  8. Step-by-step derivation
    1. associate-/l*58.0%

      \[\leadsto \color{blue}{\frac{{alphay}^{2}}{\frac{sin2phi}{u0}}} \]
  9. Simplified58.0%

    \[\leadsto \color{blue}{\frac{{alphay}^{2}}{\frac{sin2phi}{u0}}} \]
  10. Step-by-step derivation
    1. unpow258.0%

      \[\leadsto \frac{\color{blue}{alphay \cdot alphay}}{\frac{sin2phi}{u0}} \]
  11. Applied egg-rr58.0%

    \[\leadsto \frac{\color{blue}{alphay \cdot alphay}}{\frac{sin2phi}{u0}} \]
  12. Final simplification58.0%

    \[\leadsto \frac{alphay \cdot alphay}{\frac{sin2phi}{u0}} \]

Reproduce

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