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

Percentage Accurate: 60.5% → 98.5%
Time: 14.2s
Alternatives: 15
Speedup: 12.7×

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 15 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.5% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)}{alphax \cdot \left(alphax \cdot alphay\right)}}\right)\right)} \]
    2. expm1-udef52.6%

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)} - 1} \]
  10. Step-by-step derivation
    1. expm1-def96.7%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)\right)} \]
    2. expm1-log1p98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\color{blue}{alphay \cdot cos2phi} + \frac{sin2phi \cdot {alphax}^{2}}{alphay}} \cdot \left(alphay \cdot \left(alphax \cdot alphax\right)\right) \]
    9. fma-def98.2%

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

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

      \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(alphay, cos2phi, \color{blue}{\frac{{alphax}^{2}}{\frac{alphay}{sin2phi}}}\right)} \cdot \left(alphay \cdot \left(alphax \cdot alphax\right)\right) \]
    12. unpow298.6%

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

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

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

Alternative 2: 98.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)}{alphax \cdot \left(alphax \cdot alphay\right)}}\right)\right)} \]
    2. expm1-udef52.6%

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)} - 1} \]
  10. Step-by-step derivation
    1. expm1-def96.7%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)\right)} \]
    2. expm1-log1p98.2%

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

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

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

    \[\leadsto \color{blue}{\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphay \cdot \left(alphax \cdot alphax\right)\right)} \]
  12. Step-by-step derivation
    1. fma-udef98.5%

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

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

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

Alternative 3: 87.1% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 55.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*55.1%

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

      \[\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 74.8%

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

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

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

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

        \[\leadsto \frac{u0}{\color{blue}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}} \]
      2. associate-/r*74.8%

        \[\leadsto \frac{u0}{\color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}} + \frac{cos2phi}{alphax \cdot alphax}} \]
      3. associate-/r*74.8%

        \[\leadsto \frac{u0}{\frac{\frac{sin2phi}{alphay}}{alphay} + \color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}}} \]
      4. frac-2neg74.8%

        \[\leadsto \frac{u0}{\frac{\frac{sin2phi}{alphay}}{alphay} + \color{blue}{\frac{-\frac{cos2phi}{alphax}}{-alphax}}} \]
      5. frac-add74.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{u0}{\frac{alphay \cdot \frac{-cos2phi}{alphax} - \frac{sin2phi}{\frac{alphay}{alphax}}}{\color{blue}{-alphax \cdot alphay}}} \]
      8. distribute-rgt-neg-in74.9%

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

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

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

    1. Initial program 69.3%

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

        \[\leadsto \frac{\color{blue}{0 - \log \left(1 - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. div-sub69.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-identity69.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-sub69.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-identity69.3%

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

        \[\leadsto \frac{\color{blue}{-\log \left(1 - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. sub-neg69.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.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, \color{blue}{cos2phi \cdot alphay}\right)}{\left(alphax \cdot alphax\right) \cdot alphay}} \]
      4. associate-*l*97.2%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)}{alphax \cdot \left(alphax \cdot alphay\right)}}\right)\right)} \]
      2. expm1-udef31.7%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def98.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)\right)} \]
      2. expm1-log1p98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\mathsf{log1p}\left(-u0\right)} \cdot \frac{{alphay}^{2}}{sin2phi} \]
      5. unpow296.2%

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

        \[\leadsto -\mathsf{log1p}\left(-u0\right) \cdot \color{blue}{\frac{alphay}{\frac{sin2phi}{alphay}}} \]
    17. Simplified96.2%

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

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

Alternative 4: 98.4% 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 63.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.4% 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 63.5%

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

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

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

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

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

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

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

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

      \[\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-63.5%

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

      \[\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-163.5%

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

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

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

Alternative 6: 83.6% accurate, 4.1× speedup?

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

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

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


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

    1. Initial program 55.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*55.1%

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

      \[\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 74.8%

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

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

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

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

        \[\leadsto \frac{u0}{\color{blue}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}} \]
      2. associate-/r*74.8%

        \[\leadsto \frac{u0}{\color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}} + \frac{cos2phi}{alphax \cdot alphax}} \]
      3. associate-/r*74.8%

        \[\leadsto \frac{u0}{\frac{\frac{sin2phi}{alphay}}{alphay} + \color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}}} \]
      4. frac-2neg74.8%

        \[\leadsto \frac{u0}{\frac{\frac{sin2phi}{alphay}}{alphay} + \color{blue}{\frac{-\frac{cos2phi}{alphax}}{-alphax}}} \]
      5. frac-add74.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{u0}{\frac{alphay \cdot \frac{-cos2phi}{alphax} - \frac{sin2phi}{\frac{alphay}{alphax}}}{\color{blue}{-alphax \cdot alphay}}} \]
      8. distribute-rgt-neg-in74.9%

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

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

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

    1. Initial program 69.3%

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

        \[\leadsto \frac{\color{blue}{0 - \log \left(1 - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      2. div-sub69.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-identity69.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-sub69.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-identity69.3%

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

        \[\leadsto \frac{\color{blue}{-\log \left(1 - u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
      7. sub-neg69.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.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, \color{blue}{cos2phi \cdot alphay}\right)}{\left(alphax \cdot alphax\right) \cdot alphay}} \]
      4. associate-*l*97.2%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)}{alphax \cdot \left(alphax \cdot alphay\right)}}\right)\right)} \]
      2. expm1-udef31.7%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def98.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)\right)} \]
      2. expm1-log1p98.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 81.8% accurate, 4.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-alphay \cdot alphay}{sin2phi \cdot 0.5 - \frac{sin2phi}{u0}}\\


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

    1. Initial program 56.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*56.3%

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

      \[\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 73.7%

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

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

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

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

        \[\leadsto \frac{u0}{\color{blue}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}} \]
      2. associate-/r*73.7%

        \[\leadsto \frac{u0}{\color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}} + \frac{cos2phi}{alphax \cdot alphax}} \]
      3. associate-/r*73.7%

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

        \[\leadsto \frac{u0}{\frac{\frac{sin2phi}{alphay}}{alphay} + \color{blue}{\frac{-\frac{cos2phi}{alphax}}{-alphax}}} \]
      5. frac-add73.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{u0}{\frac{alphay \cdot \frac{-cos2phi}{alphax} - \frac{sin2phi}{\frac{alphay}{alphax}}}{\color{blue}{-alphax \cdot alphay}}} \]
      8. distribute-rgt-neg-in73.8%

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

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

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

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, \color{blue}{cos2phi \cdot alphay}\right)}{\left(alphax \cdot alphax\right) \cdot alphay}} \]
      4. associate-*l*97.2%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)}{alphax \cdot \left(alphax \cdot alphay\right)}}\right)\right)} \]
      2. expm1-udef30.4%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def98.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)\right)} \]
      2. expm1-log1p98.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto -\frac{alphay \cdot alphay}{\color{blue}{-1 \cdot \frac{sin2phi}{u0} + 0.5 \cdot sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.6%

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

Alternative 8: 81.8% accurate, 5.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-alphay \cdot alphay}{sin2phi \cdot 0.5 - \frac{sin2phi}{u0}}\\


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

    1. Initial program 56.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*56.3%

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

      \[\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 73.7%

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

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

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

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

        \[\leadsto \frac{u0}{\color{blue}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}} \]
      2. associate-/r*73.7%

        \[\leadsto \frac{u0}{\color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}} + \frac{cos2phi}{alphax \cdot alphax}} \]
      3. associate-/r*73.7%

        \[\leadsto \frac{u0}{\frac{\frac{sin2phi}{alphay}}{alphay} + \color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}}} \]
      4. frac-add73.8%

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

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

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

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, \color{blue}{cos2phi \cdot alphay}\right)}{\left(alphax \cdot alphax\right) \cdot alphay}} \]
      4. associate-*l*97.2%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)}{alphax \cdot \left(alphax \cdot alphay\right)}}\right)\right)} \]
      2. expm1-udef30.4%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def98.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)\right)} \]
      2. expm1-log1p98.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto -\frac{alphay \cdot alphay}{\color{blue}{-1 \cdot \frac{sin2phi}{u0} + 0.5 \cdot sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.6%

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

Alternative 9: 81.8% accurate, 5.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-alphay \cdot alphay}{sin2phi \cdot 0.5 - \frac{sin2phi}{u0}}\\


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

    1. Initial program 56.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*56.3%

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

      \[\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 73.7%

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

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

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

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

        \[\leadsto \frac{u0}{\color{blue}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}} \]
      2. associate-/r*73.7%

        \[\leadsto \frac{u0}{\color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}} + \frac{cos2phi}{alphax \cdot alphax}} \]
      3. associate-/r*73.7%

        \[\leadsto \frac{u0}{\frac{\frac{sin2phi}{alphay}}{alphay} + \color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}}} \]
      4. frac-add73.8%

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

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

      \[\leadsto \frac{u0}{\frac{\color{blue}{\frac{sin2phi \cdot alphax}{alphay}} + alphay \cdot \frac{cos2phi}{alphax}}{alphay \cdot alphax}} \]
    10. Step-by-step derivation
      1. *-commutative73.8%

        \[\leadsto \frac{u0}{\frac{\frac{\color{blue}{alphax \cdot sin2phi}}{alphay} + alphay \cdot \frac{cos2phi}{alphax}}{alphay \cdot alphax}} \]
      2. associate-/l*73.8%

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

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

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

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, \color{blue}{cos2phi \cdot alphay}\right)}{\left(alphax \cdot alphax\right) \cdot alphay}} \]
      4. associate-*l*97.2%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)}{alphax \cdot \left(alphax \cdot alphay\right)}}\right)\right)} \]
      2. expm1-udef30.4%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def98.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)\right)} \]
      2. expm1-log1p98.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto -\frac{alphay \cdot alphay}{\color{blue}{-1 \cdot \frac{sin2phi}{u0} + 0.5 \cdot sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.6%

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

Alternative 10: 81.8% accurate, 6.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-alphay \cdot alphay}{sin2phi \cdot 0.5 - \frac{sin2phi}{u0}}\\


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

    1. Initial program 56.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*56.3%

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

      \[\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 73.7%

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

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

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

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

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

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, \color{blue}{cos2phi \cdot alphay}\right)}{\left(alphax \cdot alphax\right) \cdot alphay}} \]
      4. associate-*l*97.2%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)}{alphax \cdot \left(alphax \cdot alphay\right)}}\right)\right)} \]
      2. expm1-udef30.4%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def98.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{sin2phi}{alphay}, alphax \cdot alphax, cos2phi \cdot alphay\right)} \cdot \left(alphax \cdot \left(alphax \cdot alphay\right)\right)\right)\right)} \]
      2. expm1-log1p98.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto -\frac{alphay \cdot alphay}{\color{blue}{-1 \cdot \frac{sin2phi}{u0} + 0.5 \cdot sin2phi}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.6%

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

Alternative 11: 66.8% accurate, 8.8× speedup?

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

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

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


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

    1. Initial program 57.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*57.4%

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

      \[\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 72.2%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}} \]
    9. Simplified55.5%

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

    if 5.49999986e-16 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 65.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*65.1%

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

      \[\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 74.6%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(alphay \cdot alphay\right) \cdot u0}}{sin2phi} \]
      3. *-lft-identity67.9%

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

        \[\leadsto \color{blue}{\frac{alphay \cdot alphay}{1} \cdot \frac{u0}{sin2phi}} \]
      5. /-rgt-identity67.9%

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

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

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

Alternative 12: 66.8% accurate, 8.8× speedup?

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

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

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


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

    1. Initial program 57.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*57.4%

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

      \[\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 72.2%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}} \]
    9. Simplified55.5%

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

    if 5.49999986e-16 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 65.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*65.1%

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

      \[\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 74.6%

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

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

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

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

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

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

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

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

Alternative 13: 75.6% 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 63.5%

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

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

    \[\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 74.1%

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

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

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

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

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

Alternative 14: 66.7% accurate, 12.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if sin2phi < 1.10000003e-19

    1. Initial program 54.4%

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

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

      \[\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 74.1%

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

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

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

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

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

        \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
      2. *-commutative53.9%

        \[\leadsto \frac{\color{blue}{\left(alphax \cdot alphax\right) \cdot u0}}{cos2phi} \]
      3. *-lft-identity53.9%

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

        \[\leadsto \color{blue}{\frac{alphax \cdot alphax}{1} \cdot \frac{u0}{cos2phi}} \]
      5. /-rgt-identity53.9%

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

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

    if 1.10000003e-19 < sin2phi

    1. Initial program 66.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*66.0%

        \[\leadsto \frac{-\log \left(1 - u0\right)}{\color{blue}{\frac{\frac{cos2phi}{alphax}}{alphax}} + \frac{sin2phi}{alphay \cdot alphay}} \]
    3. Simplified66.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 74.1%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(alphay \cdot alphay\right) \cdot u0}}{sin2phi} \]
      3. *-lft-identity67.4%

        \[\leadsto \frac{\left(alphay \cdot alphay\right) \cdot u0}{\color{blue}{1 \cdot sin2phi}} \]
      4. times-frac67.4%

        \[\leadsto \color{blue}{\frac{alphay \cdot alphay}{1} \cdot \frac{u0}{sin2phi}} \]
      5. /-rgt-identity67.4%

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

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

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

Alternative 15: 23.4% accurate, 16.6× speedup?

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

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

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

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

    \[\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 74.1%

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

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

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

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

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

      \[\leadsto \frac{u0 \cdot \color{blue}{\left(alphax \cdot alphax\right)}}{cos2phi} \]
    2. *-commutative22.9%

      \[\leadsto \frac{\color{blue}{\left(alphax \cdot alphax\right) \cdot u0}}{cos2phi} \]
    3. *-lft-identity22.9%

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

      \[\leadsto \color{blue}{\frac{alphax \cdot alphax}{1} \cdot \frac{u0}{cos2phi}} \]
    5. /-rgt-identity22.9%

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

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

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

Reproduce

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