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

Percentage Accurate: 60.5% → 98.3%
Time: 15.7s
Alternatives: 18
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 18 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.5% 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{alphax \cdot \left(-alphax \cdot sin2phi\right)}{alphay} - alphay \cdot cos2phi} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right) \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (*
  (/
   (log1p (- u0))
   (- (/ (* alphax (- (* alphax sin2phi))) alphay) (* alphay cos2phi)))
  (* alphax (* alphax alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return (log1pf(-u0) / (((alphax * -(alphax * sin2phi)) / alphay) - (alphay * cos2phi))) * (alphax * (alphax * alphay));
}
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(log1p(Float32(-u0)) / Float32(Float32(Float32(alphax * Float32(-Float32(alphax * sin2phi))) / alphay) - Float32(alphay * cos2phi))) * Float32(alphax * Float32(alphax * alphay)))
end
\begin{array}{l}

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Simplified98.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. +-commutative98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot 1}{\frac{\frac{-sin2phi}{\frac{\frac{alphay}{alphax}}{alphax}} - cos2phi \cdot alphay}{alphax \cdot \left(alphax \cdot \left(-alphay\right)\right)}}} \]
    2. *-rgt-identity97.5%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 92.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;t_0 \leq 100000:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{alphay \cdot \left(alphay \cdot \left(-\mathsf{log1p}\left(-u0\right)\right)\right)}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (/ sin2phi (* alphay alphay))))
   (if (<= t_0 100000.0)
     (/ (- u0 (* u0 (* u0 -0.5))) (+ (/ (/ cos2phi alphax) alphax) t_0))
     (/ (* alphay (* alphay (- (log1p (- 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 <= 100000.0f) {
		tmp = (u0 - (u0 * (u0 * -0.5f))) / (((cos2phi / alphax) / alphax) + t_0);
	} else {
		tmp = (alphay * (alphay * -log1pf(-u0))) / sin2phi;
	}
	return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(sin2phi / Float32(alphay * alphay))
	tmp = Float32(0.0)
	if (t_0 <= Float32(100000.0))
		tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(Float32(cos2phi / alphax) / alphax) + t_0));
	else
		tmp = Float32(Float32(alphay * Float32(alphay * Float32(-log1p(Float32(-u0))))) / sin2phi);
	end
	return tmp
end
\begin{array}{l}

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

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


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

    1. Initial program 54.0%

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

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

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

      \[\leadsto \frac{-\color{blue}{\left(-1 \cdot u0 + -0.5 \cdot {u0}^{2}\right)}}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Step-by-step derivation
      1. +-commutative46.3%

        \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} + -1 \cdot u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      2. mul-1-neg46.3%

        \[\leadsto -\frac{\left(-0.5 \cdot {u0}^{2} + \color{blue}{\left(-u0\right)}\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      3. unsub-neg46.3%

        \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} - u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      4. unpow246.3%

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

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

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

    if 1e5 < (/.f32 sin2phi (*.f32 alphay alphay))

    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)}{\color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}} + \frac{sin2phi}{alphay \cdot alphay}} \]
    3. Simplified61.6%

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\log \left(1 - u0\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi}} \]
    7. Taylor expanded in alphay around 0 63.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 100000:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{sin2phi}{alphay \cdot alphay}}\\ \mathbf{else}:\\ \;\;\;\;\frac{alphay \cdot \left(alphay \cdot \left(-\mathsf{log1p}\left(-u0\right)\right)\right)}{sin2phi}\\ \end{array} \]

Alternative 3: 92.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;t_0 \leq 100000:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + t_0}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(-u0\right) \cdot \frac{-alphay \cdot alphay}{sin2phi}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (/ sin2phi (* alphay alphay))))
   (if (<= t_0 100000.0)
     (/ (- u0 (* u0 (* u0 -0.5))) (+ (/ (/ cos2phi alphax) alphax) t_0))
     (* (log1p (- u0)) (/ (- (* alphay alphay)) sin2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = sin2phi / (alphay * alphay);
	float tmp;
	if (t_0 <= 100000.0f) {
		tmp = (u0 - (u0 * (u0 * -0.5f))) / (((cos2phi / alphax) / alphax) + t_0);
	} else {
		tmp = log1pf(-u0) * (-(alphay * alphay) / sin2phi);
	}
	return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi)
	t_0 = Float32(sin2phi / Float32(alphay * alphay))
	tmp = Float32(0.0)
	if (t_0 <= Float32(100000.0))
		tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(Float32(cos2phi / alphax) / alphax) + t_0));
	else
		tmp = Float32(log1p(Float32(-u0)) * Float32(Float32(-Float32(alphay * alphay)) / sin2phi));
	end
	return tmp
end
\begin{array}{l}

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

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


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

    1. Initial program 54.0%

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

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

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

      \[\leadsto \frac{-\color{blue}{\left(-1 \cdot u0 + -0.5 \cdot {u0}^{2}\right)}}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    5. Step-by-step derivation
      1. +-commutative46.3%

        \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} + -1 \cdot u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      2. mul-1-neg46.3%

        \[\leadsto -\frac{\left(-0.5 \cdot {u0}^{2} + \color{blue}{\left(-u0\right)}\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      3. unsub-neg46.3%

        \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} - u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      4. unpow246.3%

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

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

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

    if 1e5 < (/.f32 sin2phi (*.f32 alphay alphay))

    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. neg-sub061.6%

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

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

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

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

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

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

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

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

      \[\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. +-commutative97.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{\color{blue}{\left(-alphax \cdot alphax\right)} \cdot sin2phi}{alphay} - alphay \cdot cos2phi}{alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)}} \]
      8. distribute-lft-neg-in96.7%

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{-sin2phi}{\frac{alphay}{alphax \cdot alphax}} - \color{blue}{cos2phi \cdot alphay}}{alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)}} \]
      13. distribute-lft-neg-out96.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \color{blue}{\frac{{alphay}^{2}}{sin2phi}} \]
    13. Step-by-step derivation
      1. unpow298.9%

        \[\leadsto \left(-\mathsf{log1p}\left(-u0\right)\right) \cdot \frac{\color{blue}{alphay \cdot alphay}}{sin2phi} \]
    14. Simplified98.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 100000:\\ \;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{sin2phi}{alphay \cdot alphay}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(-u0\right) \cdot \frac{-alphay \cdot alphay}{sin2phi}\\ \end{array} \]

Alternative 4: 98.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{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(Float32(cos2phi / alphax) / alphax) + Float32(sin2phi / Float32(alphay * alphay))))
end
\begin{array}{l}

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0 - \log \color{blue}{\left(\left(-u0\right) + 1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    8. neg-sub057.9%

      \[\leadsto \frac{0 - \log \left(\color{blue}{\left(0 - u0\right)} + 1\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    9. associate-+l-57.9%

      \[\leadsto \frac{0 - \log \color{blue}{\left(0 - \left(u0 - 1\right)\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    10. sub0-neg57.9%

      \[\leadsto \frac{0 - \log \color{blue}{\left(-\left(u0 - 1\right)\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    11. neg-mul-157.9%

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

      \[\leadsto \frac{0 - \color{blue}{\left(\log -1 + \log \left(u0 - 1\right)\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
    13. associate--r+-0.0%

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

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

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

Alternative 6: 87.6% accurate, 4.5× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Simplified98.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. +-commutative98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot 1}{\frac{\frac{-sin2phi}{\frac{\frac{alphay}{alphax}}{alphax}} - cos2phi \cdot alphay}{alphax \cdot \left(alphax \cdot \left(-alphay\right)\right)}}} \]
    2. *-rgt-identity97.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\color{blue}{\left(-1 \cdot u0 + -0.5 \cdot {u0}^{2}\right)}}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
  13. Step-by-step derivation
    1. +-commutative87.9%

      \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\color{blue}{\left(-0.5 \cdot {u0}^{2} + -1 \cdot u0\right)}}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
    2. neg-mul-187.9%

      \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\left(-0.5 \cdot {u0}^{2} + \color{blue}{\left(-u0\right)}\right)}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
    3. unsub-neg87.9%

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

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

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

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

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

    \[\leadsto \color{blue}{\left(-1 \cdot \left(alphay \cdot {alphax}^{2}\right)\right)} \cdot \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
  16. Step-by-step derivation
    1. mul-1-neg87.9%

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

      \[\leadsto \left(-\color{blue}{{alphax}^{2} \cdot alphay}\right) \cdot \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
    3. unpow287.9%

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

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

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

Alternative 7: 87.6% accurate, 4.5× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Simplified98.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. +-commutative98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-\mathsf{log1p}\left(-u0\right)\right) \cdot 1}{\frac{\frac{-sin2phi}{\frac{\frac{alphay}{alphax}}{alphax}} - cos2phi \cdot alphay}{alphax \cdot \left(alphax \cdot \left(-alphay\right)\right)}}} \]
    2. *-rgt-identity97.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\color{blue}{\left(-1 \cdot u0 + -0.5 \cdot {u0}^{2}\right)}}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
  13. Step-by-step derivation
    1. +-commutative87.9%

      \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\color{blue}{\left(-0.5 \cdot {u0}^{2} + -1 \cdot u0\right)}}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
    2. neg-mul-187.9%

      \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\left(-0.5 \cdot {u0}^{2} + \color{blue}{\left(-u0\right)}\right)}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
    3. unsub-neg87.9%

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

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

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

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

    \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\color{blue}{\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
  15. Step-by-step derivation
    1. *-un-lft-identity87.9%

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

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

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

      \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \left(1 \cdot \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{alphax \cdot \left(-sin2phi \cdot alphax\right)}{alphay} - \color{blue}{alphay \cdot cos2phi}}\right) \]
  16. Applied egg-rr87.9%

    \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \color{blue}{\left(1 \cdot \frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{alphax \cdot \left(-sin2phi \cdot alphax\right)}{alphay} - alphay \cdot cos2phi}\right)} \]
  17. Step-by-step derivation
    1. *-lft-identity87.9%

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

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

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

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

    \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \color{blue}{\frac{-\left(u0 \cdot \left(u0 \cdot -0.5\right) - u0\right)}{\frac{alphax}{\frac{alphay}{sin2phi \cdot \left(-alphax\right)}} - cos2phi \cdot alphay}} \]
  19. Final simplification88.0%

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

Alternative 8: 81.5% accurate, 4.6× speedup?

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

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

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


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

    1. Initial program 54.1%

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

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

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

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    5. Step-by-step derivation
      1. unpow275.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      2. unpow275.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    6. Simplified75.8%

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

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. div-inv75.9%

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

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

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

    1. Initial program 61.3%

      \[\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.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\log \left(1 - u0\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi}} \]
    7. Taylor expanded in alphay around 0 62.7%

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

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

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

        \[\leadsto -\frac{\left(alphay \cdot alphay\right) \cdot \color{blue}{\mathsf{log1p}\left(-u0\right)}}{sin2phi} \]
    9. Simplified98.4%

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

      \[\leadsto -\color{blue}{\left(-0.5 \cdot \frac{{u0}^{2} \cdot {alphay}^{2}}{sin2phi} + -1 \cdot \frac{u0 \cdot {alphay}^{2}}{sin2phi}\right)} \]
    11. Step-by-step derivation
      1. mul-1-neg88.4%

        \[\leadsto -\left(-0.5 \cdot \frac{{u0}^{2} \cdot {alphay}^{2}}{sin2phi} + \color{blue}{\left(-\frac{u0 \cdot {alphay}^{2}}{sin2phi}\right)}\right) \]
      2. unsub-neg88.4%

        \[\leadsto -\color{blue}{\left(-0.5 \cdot \frac{{u0}^{2} \cdot {alphay}^{2}}{sin2phi} - \frac{u0 \cdot {alphay}^{2}}{sin2phi}\right)} \]
      3. *-commutative88.4%

        \[\leadsto -\left(-0.5 \cdot \frac{\color{blue}{{alphay}^{2} \cdot {u0}^{2}}}{sin2phi} - \frac{u0 \cdot {alphay}^{2}}{sin2phi}\right) \]
      4. unpow288.4%

        \[\leadsto -\left(-0.5 \cdot \frac{\color{blue}{\left(alphay \cdot alphay\right)} \cdot {u0}^{2}}{sin2phi} - \frac{u0 \cdot {alphay}^{2}}{sin2phi}\right) \]
      5. unpow288.4%

        \[\leadsto -\left(-0.5 \cdot \frac{\left(alphay \cdot alphay\right) \cdot \color{blue}{\left(u0 \cdot u0\right)}}{sin2phi} - \frac{u0 \cdot {alphay}^{2}}{sin2phi}\right) \]
      6. unswap-sqr88.4%

        \[\leadsto -\left(-0.5 \cdot \frac{\color{blue}{\left(alphay \cdot u0\right) \cdot \left(alphay \cdot u0\right)}}{sin2phi} - \frac{u0 \cdot {alphay}^{2}}{sin2phi}\right) \]
      7. *-commutative88.4%

        \[\leadsto -\left(-0.5 \cdot \frac{\left(alphay \cdot u0\right) \cdot \left(alphay \cdot u0\right)}{sin2phi} - \frac{\color{blue}{{alphay}^{2} \cdot u0}}{sin2phi}\right) \]
      8. *-lft-identity88.4%

        \[\leadsto -\left(-0.5 \cdot \frac{\left(alphay \cdot u0\right) \cdot \left(alphay \cdot u0\right)}{sin2phi} - \frac{{alphay}^{2} \cdot u0}{\color{blue}{1 \cdot sin2phi}}\right) \]
      9. times-frac88.4%

        \[\leadsto -\left(-0.5 \cdot \frac{\left(alphay \cdot u0\right) \cdot \left(alphay \cdot u0\right)}{sin2phi} - \color{blue}{\frac{{alphay}^{2}}{1} \cdot \frac{u0}{sin2phi}}\right) \]
      10. /-rgt-identity88.4%

        \[\leadsto -\left(-0.5 \cdot \frac{\left(alphay \cdot u0\right) \cdot \left(alphay \cdot u0\right)}{sin2phi} - \color{blue}{{alphay}^{2}} \cdot \frac{u0}{sin2phi}\right) \]
      11. unpow288.4%

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

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

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

Alternative 9: 81.5% accurate, 5.5× speedup?

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

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

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


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

    1. Initial program 54.1%

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

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

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

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    5. Step-by-step derivation
      1. unpow275.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      2. unpow275.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    6. Simplified75.8%

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

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. div-inv75.9%

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

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

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

    1. Initial program 61.3%

      \[\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.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\log \left(1 - u0\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi}} \]
    7. Taylor expanded in u0 around 0 88.2%

      \[\leadsto -\frac{\color{blue}{\left(-1 \cdot u0 + -0.5 \cdot {u0}^{2}\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
    8. Step-by-step derivation
      1. +-commutative88.2%

        \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} + -1 \cdot u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      2. mul-1-neg88.2%

        \[\leadsto -\frac{\left(-0.5 \cdot {u0}^{2} + \color{blue}{\left(-u0\right)}\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      3. unsub-neg88.2%

        \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} - u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      4. unpow288.2%

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

        \[\leadsto -\frac{\left(\color{blue}{\left(-0.5 \cdot u0\right) \cdot u0} - u0\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
    9. Simplified88.2%

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

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

Alternative 10: 81.1% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;t_0 \leq 18000:\\ \;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 + 0.5 \cdot \left(u0 \cdot u0\right)}{t_0}\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (let* ((t_0 (/ sin2phi (* alphay alphay))))
   (if (<= t_0 18000.0)
     (/ u0 (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay)))
     (/ (+ u0 (* 0.5 (* u0 u0))) t_0))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	float t_0 = sin2phi / (alphay * alphay);
	float tmp;
	if (t_0 <= 18000.0f) {
		tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay));
	} else {
		tmp = (u0 + (0.5f * (u0 * 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 (t_0 <= 18000.0e0) then
        tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay))
    else
        tmp = (u0 + (0.5e0 * (u0 * 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 (t_0 <= Float32(18000.0))
		tmp = Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay)));
	else
		tmp = Float32(Float32(u0 + Float32(Float32(0.5) * Float32(u0 * 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 (t_0 <= single(18000.0))
		tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay));
	else
		tmp = (u0 + (single(0.5) * (u0 * u0))) / t_0;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{u0 + 0.5 \cdot \left(u0 \cdot u0\right)}{t_0}\\


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

    1. Initial program 54.1%

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

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

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

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    5. Step-by-step derivation
      1. unpow275.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      2. unpow275.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    6. Simplified75.8%

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

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. div-inv75.9%

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

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{alphay} \cdot \frac{1}{alphay}}} \]
    9. Step-by-step derivation
      1. un-div-inv75.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Applied egg-rr75.8%

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

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

    1. Initial program 61.3%

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

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

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

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

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

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

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

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

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

      \[\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. +-commutative97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{\color{blue}{\left(-alphax \cdot alphax\right)} \cdot sin2phi}{alphay} - alphay \cdot cos2phi}{alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)}} \]
      8. distribute-lft-neg-in96.7%

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{-sin2phi}{\frac{alphay}{alphax \cdot alphax}} - \color{blue}{cos2phi \cdot alphay}}{alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)}} \]
      13. distribute-lft-neg-out97.0%

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{-sin2phi}{\frac{alphay}{alphax \cdot alphax}} - cos2phi \cdot alphay}{alphax \cdot \color{blue}{\left(-alphax \cdot alphay\right)}}} \]
      14. distribute-rgt-neg-in97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\color{blue}{\left(-0.5 \cdot {u0}^{2} + -1 \cdot u0\right)}}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
      2. neg-mul-188.7%

        \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\left(-0.5 \cdot {u0}^{2} + \color{blue}{\left(-u0\right)}\right)}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
      3. unsub-neg88.7%

        \[\leadsto \left(alphax \cdot \left(\left(-alphax\right) \cdot alphay\right)\right) \cdot \frac{-\color{blue}{\left(-0.5 \cdot {u0}^{2} - u0\right)}}{\frac{-alphax \cdot \left(alphax \cdot sin2phi\right)}{alphay} - cos2phi \cdot alphay} \]
      4. *-commutative88.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{u0 - -0.5 \cdot {u0}^{2}}{\frac{sin2phi}{{alphay}^{2}}}} \]
      2. cancel-sign-sub-inv87.4%

        \[\leadsto \frac{\color{blue}{u0 + \left(--0.5\right) \cdot {u0}^{2}}}{\frac{sin2phi}{{alphay}^{2}}} \]
      3. metadata-eval87.4%

        \[\leadsto \frac{u0 + \color{blue}{0.5} \cdot {u0}^{2}}{\frac{sin2phi}{{alphay}^{2}}} \]
      4. unpow287.4%

        \[\leadsto \frac{u0 + 0.5 \cdot \color{blue}{\left(u0 \cdot u0\right)}}{\frac{sin2phi}{{alphay}^{2}}} \]
      5. unpow287.4%

        \[\leadsto \frac{u0 + 0.5 \cdot \left(u0 \cdot u0\right)}{\frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    17. Simplified87.4%

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

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

Alternative 11: 81.5% accurate, 6.1× speedup?

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

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

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


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

    1. Initial program 54.1%

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

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

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

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    5. Step-by-step derivation
      1. unpow275.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      2. unpow275.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    6. Simplified75.8%

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

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
      2. div-inv75.9%

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

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{alphay} \cdot \frac{1}{alphay}}} \]
    9. Step-by-step derivation
      1. un-div-inv75.8%

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    10. Applied egg-rr75.8%

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

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

    1. Initial program 61.3%

      \[\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.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\log \left(1 - u0\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi}} \]
    7. Taylor expanded in u0 around 0 88.2%

      \[\leadsto -\frac{\color{blue}{\left(-1 \cdot u0 + -0.5 \cdot {u0}^{2}\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
    8. Step-by-step derivation
      1. +-commutative88.2%

        \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} + -1 \cdot u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      2. mul-1-neg88.2%

        \[\leadsto -\frac{\left(-0.5 \cdot {u0}^{2} + \color{blue}{\left(-u0\right)}\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      3. unsub-neg88.2%

        \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} - u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
      4. unpow288.2%

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

        \[\leadsto -\frac{\left(\color{blue}{\left(-0.5 \cdot u0\right) \cdot u0} - u0\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
    9. Simplified88.2%

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

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

Alternative 12: 87.5% accurate, 6.1× speedup?

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

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

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

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

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

    \[\leadsto \frac{-\color{blue}{\left(-1 \cdot u0 + -0.5 \cdot {u0}^{2}\right)}}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  5. Step-by-step derivation
    1. +-commutative68.0%

      \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} + -1 \cdot u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
    2. mul-1-neg68.0%

      \[\leadsto -\frac{\left(-0.5 \cdot {u0}^{2} + \color{blue}{\left(-u0\right)}\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
    3. unsub-neg68.0%

      \[\leadsto -\frac{\color{blue}{\left(-0.5 \cdot {u0}^{2} - u0\right)} \cdot \left(alphay \cdot alphay\right)}{sin2phi} \]
    4. unpow268.0%

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

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

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

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

Alternative 13: 67.0% accurate, 8.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 1.9999999920083944 \cdot 10^{-11}:\\ \;\;\;\;alphax \cdot \frac{alphax \cdot u0}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;u0 \cdot \left(alphay \cdot \frac{alphay}{sin2phi}\right)\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 1.9999999920083944e-11)
   (* 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)) <= 1.9999999920083944e-11f) {
		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)) <= 1.9999999920083944e-11) 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(1.9999999920083944e-11))
		tmp = Float32(alphax * Float32(Float32(alphax * u0) / cos2phi));
	else
		tmp = Float32(u0 * Float32(alphay * Float32(alphay / sin2phi)));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(1.9999999920083944e-11))
		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 1.9999999920083944 \cdot 10^{-11}:\\
\;\;\;\;alphax \cdot \frac{alphax \cdot u0}{cos2phi}\\

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


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

    1. Initial program 55.0%

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

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

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

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
    5. Step-by-step derivation
      1. unpow275.0%

        \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
      2. unpow275.0%

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    6. Simplified75.0%

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

      \[\leadsto \color{blue}{\frac{u0 \cdot {alphax}^{2}}{cos2phi}} \]
    8. Step-by-step derivation
      1. unpow254.5%

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

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}} \]
      3. associate-/r/54.4%

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

      \[\leadsto \color{blue}{\frac{u0}{cos2phi} \cdot \left(alphax \cdot alphax\right)} \]
    10. Taylor expanded in u0 around 0 54.5%

      \[\leadsto \color{blue}{\frac{u0 \cdot {alphax}^{2}}{cos2phi}} \]
    11. Step-by-step derivation
      1. associate-*l/54.4%

        \[\leadsto \color{blue}{\frac{u0}{cos2phi} \cdot {alphax}^{2}} \]
      2. *-commutative54.4%

        \[\leadsto \color{blue}{{alphax}^{2} \cdot \frac{u0}{cos2phi}} \]
      3. unpow254.4%

        \[\leadsto \color{blue}{\left(alphax \cdot alphax\right)} \cdot \frac{u0}{cos2phi} \]
      4. associate-*l*54.4%

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

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

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

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

    1. Initial program 59.0%

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

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

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

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

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

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    6. Simplified76.7%

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

        \[\leadsto \color{blue}{u0 \cdot \frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
      2. +-commutative76.7%

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

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

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

        \[\leadsto u0 \cdot \frac{\color{blue}{alphay \cdot alphay}}{sin2phi} \]
      2. *-lft-identity73.1%

        \[\leadsto u0 \cdot \frac{alphay \cdot alphay}{\color{blue}{1 \cdot sin2phi}} \]
      3. times-frac73.3%

        \[\leadsto u0 \cdot \color{blue}{\left(\frac{alphay}{1} \cdot \frac{alphay}{sin2phi}\right)} \]
      4. /-rgt-identity73.3%

        \[\leadsto u0 \cdot \left(\color{blue}{alphay} \cdot \frac{alphay}{sin2phi}\right) \]
    11. Simplified73.3%

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

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

Alternative 14: 67.0% accurate, 8.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 1.9999999920083944 \cdot 10^{-11}:\\ \;\;\;\;\frac{alphax \cdot \left(alphax \cdot u0\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;u0 \cdot \left(alphay \cdot \frac{alphay}{sin2phi}\right)\\ \end{array} \end{array} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (if (<= (/ sin2phi (* alphay alphay)) 1.9999999920083944e-11)
   (/ (* 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)) <= 1.9999999920083944e-11f) {
		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)) <= 1.9999999920083944e-11) 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(1.9999999920083944e-11))
		tmp = Float32(Float32(alphax * Float32(alphax * u0)) / cos2phi);
	else
		tmp = Float32(u0 * Float32(alphay * Float32(alphay / sin2phi)));
	end
	return tmp
end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi)
	tmp = single(0.0);
	if ((sin2phi / (alphay * alphay)) <= single(1.9999999920083944e-11))
		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 1.9999999920083944 \cdot 10^{-11}:\\
\;\;\;\;\frac{alphax \cdot \left(alphax \cdot u0\right)}{cos2phi}\\

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


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

    1. Initial program 55.0%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{\log \left(1 - u0\right) \cdot {alphax}^{2}}{cos2phi}} \]
    5. Step-by-step derivation
      1. associate-*r/41.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(\log \left(1 - u0\right) \cdot {alphax}^{2}\right)}{cos2phi}} \]
      2. unpow241.0%

        \[\leadsto \frac{-1 \cdot \left(\log \left(1 - u0\right) \cdot \color{blue}{\left(alphax \cdot alphax\right)}\right)}{cos2phi} \]
      3. *-commutative41.0%

        \[\leadsto \frac{-1 \cdot \color{blue}{\left(\left(alphax \cdot alphax\right) \cdot \log \left(1 - u0\right)\right)}}{cos2phi} \]
      4. associate-*r*41.0%

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot \left(alphax \cdot alphax\right)\right) \cdot \log \left(1 - u0\right)}}{cos2phi} \]
      5. neg-mul-141.0%

        \[\leadsto \frac{\color{blue}{\left(-alphax \cdot alphax\right)} \cdot \log \left(1 - u0\right)}{cos2phi} \]
      6. distribute-rgt-neg-out41.0%

        \[\leadsto \frac{\color{blue}{\left(alphax \cdot \left(-alphax\right)\right)} \cdot \log \left(1 - u0\right)}{cos2phi} \]
      7. sub-neg41.0%

        \[\leadsto \frac{\left(alphax \cdot \left(-alphax\right)\right) \cdot \log \color{blue}{\left(1 + \left(-u0\right)\right)}}{cos2phi} \]
      8. mul-1-neg41.0%

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

        \[\leadsto \frac{\left(alphax \cdot \left(-alphax\right)\right) \cdot \color{blue}{\mathsf{log1p}\left(-1 \cdot u0\right)}}{cos2phi} \]
      10. mul-1-neg68.8%

        \[\leadsto \frac{\left(alphax \cdot \left(-alphax\right)\right) \cdot \mathsf{log1p}\left(\color{blue}{-u0}\right)}{cos2phi} \]
    6. Simplified68.8%

      \[\leadsto \color{blue}{\frac{\left(alphax \cdot \left(-alphax\right)\right) \cdot \mathsf{log1p}\left(-u0\right)}{cos2phi}} \]
    7. Taylor expanded in u0 around 0 54.5%

      \[\leadsto \frac{\color{blue}{u0 \cdot {alphax}^{2}}}{cos2phi} \]
    8. Step-by-step derivation
      1. *-commutative54.5%

        \[\leadsto \frac{\color{blue}{{alphax}^{2} \cdot u0}}{cos2phi} \]
      2. unpow254.5%

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

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

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

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

    1. Initial program 59.0%

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

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

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

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

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

        \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
    6. Simplified76.7%

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

        \[\leadsto \color{blue}{u0 \cdot \frac{1}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
      2. +-commutative76.7%

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

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

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

        \[\leadsto u0 \cdot \frac{\color{blue}{alphay \cdot alphay}}{sin2phi} \]
      2. *-lft-identity73.1%

        \[\leadsto u0 \cdot \frac{alphay \cdot alphay}{\color{blue}{1 \cdot sin2phi}} \]
      3. times-frac73.3%

        \[\leadsto u0 \cdot \color{blue}{\left(\frac{alphay}{1} \cdot \frac{alphay}{sin2phi}\right)} \]
      4. /-rgt-identity73.3%

        \[\leadsto u0 \cdot \left(\color{blue}{alphay} \cdot \frac{alphay}{sin2phi}\right) \]
    11. Simplified73.3%

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

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

Alternative 15: 76.0% accurate, 8.9× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
  5. Step-by-step derivation
    1. unpow276.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
    2. unpow276.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
  6. Simplified76.3%

    \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
  7. Final simplification76.3%

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

Alternative 16: 76.0% 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 57.9%

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

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

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

    \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
  5. Step-by-step derivation
    1. unpow276.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
    2. unpow276.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
  6. Simplified76.3%

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

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    2. div-inv76.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{alphay} \cdot \frac{1}{alphay}}} \]
  8. Applied egg-rr76.3%

    \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{sin2phi}{alphay} \cdot \frac{1}{alphay}}} \]
  9. Step-by-step derivation
    1. un-div-inv76.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
  10. Applied egg-rr76.3%

    \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
  11. Final simplification76.3%

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

Alternative 17: 24.0% accurate, 16.6× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
  5. Step-by-step derivation
    1. unpow276.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
    2. unpow276.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
  6. Simplified76.3%

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

    \[\leadsto \color{blue}{\frac{u0 \cdot {alphax}^{2}}{cos2phi}} \]
  8. Step-by-step derivation
    1. unpow222.4%

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

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}} \]
    3. associate-/r/22.4%

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

    \[\leadsto \color{blue}{\frac{u0}{cos2phi} \cdot \left(alphax \cdot alphax\right)} \]
  10. Taylor expanded in u0 around 0 22.4%

    \[\leadsto \color{blue}{\frac{u0 \cdot {alphax}^{2}}{cos2phi}} \]
  11. Step-by-step derivation
    1. associate-*l/22.4%

      \[\leadsto \color{blue}{\frac{u0}{cos2phi} \cdot {alphax}^{2}} \]
    2. *-commutative22.4%

      \[\leadsto \color{blue}{{alphax}^{2} \cdot \frac{u0}{cos2phi}} \]
    3. unpow222.4%

      \[\leadsto \color{blue}{\left(alphax \cdot alphax\right)} \cdot \frac{u0}{cos2phi} \]
    4. associate-*l*22.4%

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

    \[\leadsto \color{blue}{alphax \cdot \left(alphax \cdot \frac{u0}{cos2phi}\right)} \]
  13. Final simplification22.4%

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

Alternative 18: 24.0% accurate, 16.6× speedup?

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

\\
alphax \cdot \frac{alphax \cdot u0}{cos2phi}
\end{array}
Derivation
  1. Initial program 57.9%

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

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

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

    \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{{alphax}^{2}} + \frac{sin2phi}{{alphay}^{2}}}} \]
  5. Step-by-step derivation
    1. unpow276.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{\color{blue}{alphax \cdot alphax}} + \frac{sin2phi}{{alphay}^{2}}} \]
    2. unpow276.3%

      \[\leadsto \frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{\color{blue}{alphay \cdot alphay}}} \]
  6. Simplified76.3%

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

    \[\leadsto \color{blue}{\frac{u0 \cdot {alphax}^{2}}{cos2phi}} \]
  8. Step-by-step derivation
    1. unpow222.4%

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

      \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}} \]
    3. associate-/r/22.4%

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

    \[\leadsto \color{blue}{\frac{u0}{cos2phi} \cdot \left(alphax \cdot alphax\right)} \]
  10. Taylor expanded in u0 around 0 22.4%

    \[\leadsto \color{blue}{\frac{u0 \cdot {alphax}^{2}}{cos2phi}} \]
  11. Step-by-step derivation
    1. associate-*l/22.4%

      \[\leadsto \color{blue}{\frac{u0}{cos2phi} \cdot {alphax}^{2}} \]
    2. *-commutative22.4%

      \[\leadsto \color{blue}{{alphax}^{2} \cdot \frac{u0}{cos2phi}} \]
    3. unpow222.4%

      \[\leadsto \color{blue}{\left(alphax \cdot alphax\right)} \cdot \frac{u0}{cos2phi} \]
    4. associate-*l*22.4%

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

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

    \[\leadsto alphax \cdot \color{blue}{\frac{u0 \cdot alphax}{cos2phi}} \]
  14. Final simplification22.4%

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

Reproduce

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