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

Percentage Accurate: 60.7% → 98.4%
Time: 20.6s
Alternatives: 12
Speedup: 8.9×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 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.7% 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.4% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{-alphax} - \frac{sin2phi}{alphay \cdot alphay}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-frac-neg298.1%

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

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

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

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

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

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

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

    \[\leadsto \frac{\mathsf{log1p}\left(-u0\right)}{\color{blue}{\left(-cos2phi\right) \cdot {alphax}^{-2}} - \frac{sin2phi}{alphay \cdot alphay}} \]
  7. Step-by-step derivation
    1. distribute-lft-neg-out98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\mathsf{log1p}\left(-u0\right)}{\frac{alphax \cdot sin2phi + \frac{{alphay}^{2} \cdot cos2phi}{alphax}}{alphay}} \cdot \left(alphax \cdot \left(-alphay\right)\right) \]
  15. Add Preprocessing

Alternative 2: 98.4% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{-alphax} - \frac{sin2phi}{alphay \cdot alphay}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-frac-neg298.1%

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

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

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

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

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

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

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

    \[\leadsto \frac{\mathsf{log1p}\left(-u0\right)}{\color{blue}{\left(-cos2phi\right) \cdot {alphax}^{-2}} - \frac{sin2phi}{alphay \cdot alphay}} \]
  7. Step-by-step derivation
    1. distribute-lft-neg-out98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 93.1% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{alphax \cdot sin2phi}{alphay} + \frac{alphay \cdot cos2phi}{alphax}\\
t_1 := \frac{1}{t\_0}\\
\left(alphax \cdot alphay\right) \cdot \left(u0 \cdot \left(t\_1 + u0 \cdot \left(t\_1 \cdot 0.5 + u0 \cdot \left(0.3333333333333333 \cdot t\_1 - -0.25 \cdot \frac{u0}{t\_0}\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{-alphax} - \frac{sin2phi}{alphay \cdot alphay}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-frac-neg298.1%

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

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

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

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

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

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

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

    \[\leadsto \frac{\mathsf{log1p}\left(-u0\right)}{\color{blue}{\left(-cos2phi\right) \cdot {alphax}^{-2}} - \frac{sin2phi}{alphay \cdot alphay}} \]
  7. Step-by-step derivation
    1. distribute-lft-neg-out98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(u0 \cdot \left(u0 \cdot \left(u0 \cdot \left(-0.25 \cdot \frac{u0}{\frac{alphax \cdot sin2phi}{alphay} + \frac{alphay \cdot cos2phi}{alphax}} - 0.3333333333333333 \cdot \frac{1}{\frac{alphax \cdot sin2phi}{alphay} + \frac{alphay \cdot cos2phi}{alphax}}\right) - 0.5 \cdot \frac{1}{\frac{alphax \cdot sin2phi}{alphay} + \frac{alphay \cdot cos2phi}{alphax}}\right) - \frac{1}{\frac{alphax \cdot sin2phi}{alphay} + \frac{alphay \cdot cos2phi}{alphax}}\right)\right)} \cdot \left(alphax \cdot \left(-alphay\right)\right) \]
  14. Final simplification93.5%

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

Alternative 5: 80.7% accurate, 4.1× speedup?

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

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

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

    if 5.00000024e-4 < (/.f32 sin2phi (*.f32 alphay alphay))

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{log1p}\left(-u0\right)}{\color{blue}{\mathsf{fma}\left(\frac{cos2phi}{alphax}, \frac{1}{-alphax}, -\frac{sin2phi}{alphay \cdot alphay}\right)}} \]
      3. add-sqr-sqrt-0.0%

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

        \[\leadsto \frac{\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{cos2phi}{alphax}, \frac{1}{\color{blue}{\sqrt{\left(-alphax\right) \cdot \left(-alphax\right)}}}, -\frac{sin2phi}{alphay \cdot alphay}\right)} \]
      5. sqr-neg96.0%

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

        \[\leadsto \frac{\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(\frac{cos2phi}{alphax}, \frac{1}{\color{blue}{\sqrt{alphax} \cdot \sqrt{alphax}}}, -\frac{sin2phi}{alphay \cdot alphay}\right)} \]
      7. add-sqr-sqrt96.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 92.9% accurate, 4.3× speedup?

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

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

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

    \[\leadsto \frac{-\color{blue}{u0 \cdot \left(u0 \cdot \left(u0 \cdot \left(-0.25 \cdot u0 - 0.3333333333333333\right) - 0.5\right) - 1\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  4. Final simplification93.1%

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

Alternative 7: 92.9% accurate, 4.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 91.1% accurate, 5.0× speedup?

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

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

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

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

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

Alternative 9: 87.3% accurate, 6.1× speedup?

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

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

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

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

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

Alternative 10: 75.9% accurate, 6.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{-alphax} - \frac{sin2phi}{alphay \cdot alphay}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-frac-neg298.1%

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

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

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

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

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

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

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

    \[\leadsto \frac{\mathsf{log1p}\left(-u0\right)}{\color{blue}{\left(-cos2phi\right) \cdot {alphax}^{-2}} - \frac{sin2phi}{alphay \cdot alphay}} \]
  7. Step-by-step derivation
    1. distribute-lft-neg-out98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{alphax \cdot \left(alphay \cdot u0\right)}{\frac{alphax \cdot sin2phi}{alphay} + \frac{alphay \cdot cos2phi}{alphax}}} \]
  12. Final simplification77.2%

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

Alternative 11: 75.7% 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 62.7%

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

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

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

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

    \[\leadsto \frac{u0}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}} \]
  7. Add Preprocessing

Alternative 12: 59.0% accurate, 16.6× speedup?

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{alphay}^{2} \cdot \frac{u0}{sin2phi}} \]
  8. Simplified61.0%

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

      \[\leadsto \color{blue}{\left(alphay \cdot alphay\right)} \cdot \frac{u0}{sin2phi} \]
  10. Applied egg-rr61.0%

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

    \[\leadsto \left(alphay \cdot alphay\right) \cdot \frac{u0}{sin2phi} \]
  12. Add Preprocessing

Reproduce

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