
(FPCore (ux uy maxCos) :precision binary32 (let* ((t_0 (+ (- 1 ux) (* ux maxCos)))) (* (cos (* (* uy 2) PI)) (sqrt (- 1 (* t_0 t_0))))))
float code(float ux, float uy, float maxCos) {
float t_0 = (1.0f - ux) + (ux * maxCos);
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (t_0 * t_0)));
}
function code(ux, uy, maxCos) t_0 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos)) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0)))) end
function tmp = code(ux, uy, maxCos) t_0 = (single(1.0) - ux) + (ux * maxCos); tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) - (t_0 * t_0))); end
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (ux uy maxCos) :precision binary32 (let* ((t_0 (+ (- 1 ux) (* ux maxCos)))) (* (cos (* (* uy 2) PI)) (sqrt (- 1 (* t_0 t_0))))))
float code(float ux, float uy, float maxCos) {
float t_0 = (1.0f - ux) + (ux * maxCos);
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (t_0 * t_0)));
}
function code(ux, uy, maxCos) t_0 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos)) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0)))) end
function tmp = code(ux, uy, maxCos) t_0 = (single(1.0) - ux) + (ux * maxCos); tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) - (t_0 * t_0))); end
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (/ PI uy) 1/2)))
(*
(sin (* uy (* (+ 1 (/ (* PI -2) t_0)) t_0)))
(sqrt
(*
ux
(- (+ 2 (* -1 (* ux (pow (- maxCos 1) 2)))) (* 2 maxCos)))))))float code(float ux, float uy, float maxCos) {
float t_0 = (((float) M_PI) / uy) * 0.5f;
return sinf((uy * ((1.0f + ((((float) M_PI) * -2.0f) / t_0)) * t_0))) * sqrtf((ux * ((2.0f + (-1.0f * (ux * powf((maxCos - 1.0f), 2.0f)))) - (2.0f * maxCos))));
}
function code(ux, uy, maxCos) t_0 = Float32(Float32(Float32(pi) / uy) * Float32(0.5)) return Float32(sin(Float32(uy * Float32(Float32(Float32(1.0) + Float32(Float32(Float32(pi) * Float32(-2.0)) / t_0)) * t_0))) * sqrt(Float32(ux * Float32(Float32(Float32(2.0) + Float32(Float32(-1.0) * Float32(ux * (Float32(maxCos - Float32(1.0)) ^ Float32(2.0))))) - Float32(Float32(2.0) * maxCos))))) end
function tmp = code(ux, uy, maxCos) t_0 = (single(pi) / uy) * single(0.5); tmp = sin((uy * ((single(1.0) + ((single(pi) * single(-2.0)) / t_0)) * t_0))) * sqrt((ux * ((single(2.0) + (single(-1.0) * (ux * ((maxCos - single(1.0)) ^ single(2.0))))) - (single(2.0) * maxCos)))); end
\begin{array}{l}
t_0 := \frac{\pi}{uy} \cdot \frac{1}{2}\\
\sin \left(uy \cdot \left(\left(1 + \frac{\pi \cdot -2}{t\_0}\right) \cdot t\_0\right)\right) \cdot \sqrt{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}
\end{array}
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
*-commutativeN/A
count-2N/A
lift-+.f32N/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
sin-+PI/2-revN/A
lower-sin.f32N/A
lift-PI.f32N/A
mult-flip-revN/A
metadata-evalN/A
lift-*.f32N/A
lower-+.f32N/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lower-*.f32N/A
lower-neg.f3299.0%
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0%
Applied rewrites99.0%
Taylor expanded in uy around inf
lower-*.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-*.f32N/A
lower-/.f32N/A
lower-PI.f3299.0%
Applied rewrites99.0%
lift-+.f32N/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f32N/A
lower-unsound-+.f32N/A
lower-unsound-/.f3299.1%
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.1%
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.1%
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.1%
Applied rewrites99.1%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (* uy (+ (* -2 PI) (* PI (/ 1/2 uy))))) (sqrt (* ux (- (+ 2 (* -1 (* ux (pow (- maxCos 1) 2)))) (* 2 maxCos))))))
float code(float ux, float uy, float maxCos) {
return sinf((uy * ((-2.0f * ((float) M_PI)) + (((float) M_PI) * (0.5f / uy))))) * sqrtf((ux * ((2.0f + (-1.0f * (ux * powf((maxCos - 1.0f), 2.0f)))) - (2.0f * maxCos))));
}
function code(ux, uy, maxCos) return Float32(sin(Float32(uy * Float32(Float32(Float32(-2.0) * Float32(pi)) + Float32(Float32(pi) * Float32(Float32(0.5) / uy))))) * sqrt(Float32(ux * Float32(Float32(Float32(2.0) + Float32(Float32(-1.0) * Float32(ux * (Float32(maxCos - Float32(1.0)) ^ Float32(2.0))))) - Float32(Float32(2.0) * maxCos))))) end
function tmp = code(ux, uy, maxCos) tmp = sin((uy * ((single(-2.0) * single(pi)) + (single(pi) * (single(0.5) / uy))))) * sqrt((ux * ((single(2.0) + (single(-1.0) * (ux * ((maxCos - single(1.0)) ^ single(2.0))))) - (single(2.0) * maxCos)))); end
\sin \left(uy \cdot \left(-2 \cdot \pi + \pi \cdot \frac{\frac{1}{2}}{uy}\right)\right) \cdot \sqrt{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
*-commutativeN/A
count-2N/A
lift-+.f32N/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
sin-+PI/2-revN/A
lower-sin.f32N/A
lift-PI.f32N/A
mult-flip-revN/A
metadata-evalN/A
lift-*.f32N/A
lower-+.f32N/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lower-*.f32N/A
lower-neg.f3299.0%
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0%
Applied rewrites99.0%
Taylor expanded in uy around inf
lower-*.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-*.f32N/A
lower-/.f32N/A
lower-PI.f3299.0%
Applied rewrites99.0%
lift-*.f32N/A
lift-/.f32N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f32N/A
lower-/.f3299.0%
Applied rewrites99.0%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (* uy (+ (* -2 PI) (* 1/2 (/ PI uy))))) (sqrt (* ux (- (+ 2 (* -1 (* ux (pow (- maxCos 1) 2)))) (* 2 maxCos))))))
float code(float ux, float uy, float maxCos) {
return sinf((uy * ((-2.0f * ((float) M_PI)) + (0.5f * (((float) M_PI) / uy))))) * sqrtf((ux * ((2.0f + (-1.0f * (ux * powf((maxCos - 1.0f), 2.0f)))) - (2.0f * maxCos))));
}
function code(ux, uy, maxCos) return Float32(sin(Float32(uy * Float32(Float32(Float32(-2.0) * Float32(pi)) + Float32(Float32(0.5) * Float32(Float32(pi) / uy))))) * sqrt(Float32(ux * Float32(Float32(Float32(2.0) + Float32(Float32(-1.0) * Float32(ux * (Float32(maxCos - Float32(1.0)) ^ Float32(2.0))))) - Float32(Float32(2.0) * maxCos))))) end
function tmp = code(ux, uy, maxCos) tmp = sin((uy * ((single(-2.0) * single(pi)) + (single(0.5) * (single(pi) / uy))))) * sqrt((ux * ((single(2.0) + (single(-1.0) * (ux * ((maxCos - single(1.0)) ^ single(2.0))))) - (single(2.0) * maxCos)))); end
\sin \left(uy \cdot \left(-2 \cdot \pi + \frac{1}{2} \cdot \frac{\pi}{uy}\right)\right) \cdot \sqrt{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
*-commutativeN/A
count-2N/A
lift-+.f32N/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
sin-+PI/2-revN/A
lower-sin.f32N/A
lift-PI.f32N/A
mult-flip-revN/A
metadata-evalN/A
lift-*.f32N/A
lower-+.f32N/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lower-*.f32N/A
lower-neg.f3299.0%
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0%
Applied rewrites99.0%
Taylor expanded in uy around inf
lower-*.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-*.f32N/A
lower-/.f32N/A
lower-PI.f3299.0%
Applied rewrites99.0%
(FPCore (ux uy maxCos)
:precision binary32
(*
(cos (* (* uy 2) PI))
(sqrt
(-
(+ ux ux)
(*
(- (+ maxCos maxCos) (* (* (- 1 maxCos) ux) (- maxCos 1)))
ux)))))float code(float ux, float uy, float maxCos) {
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf(((ux + ux) - (((maxCos + maxCos) - (((1.0f - maxCos) * ux) * (maxCos - 1.0f))) * ux)));
}
function code(ux, uy, maxCos) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(ux + ux) - Float32(Float32(Float32(maxCos + maxCos) - Float32(Float32(Float32(Float32(1.0) - maxCos) * ux) * Float32(maxCos - Float32(1.0)))) * ux)))) end
function tmp = code(ux, uy, maxCos) tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt(((ux + ux) - (((maxCos + maxCos) - (((single(1.0) - maxCos) * ux) * (maxCos - single(1.0)))) * ux))); end
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux + ux\right) - \left(\left(maxCos + maxCos\right) - \left(\left(1 - maxCos\right) \cdot ux\right) \cdot \left(maxCos - 1\right)\right) \cdot ux}
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift-*.f32N/A
lift--.f32N/A
lift-+.f32N/A
associate--l+N/A
distribute-lft-inN/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower--.f3299.0%
Applied rewrites99.0%
lift-+.f32N/A
lift-*.f32N/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
count-2-revN/A
lower-+.f32N/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-inN/A
Applied rewrites99.0%
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* (+ PI PI) uy)) (sqrt (* ux (- (- (- 2 (* (* ux (- maxCos 1)) (- maxCos 1))) maxCos) maxCos)))))
float code(float ux, float uy, float maxCos) {
return cosf(((((float) M_PI) + ((float) M_PI)) * uy)) * sqrtf((ux * (((2.0f - ((ux * (maxCos - 1.0f)) * (maxCos - 1.0f))) - maxCos) - maxCos)));
}
function code(ux, uy, maxCos) return Float32(cos(Float32(Float32(Float32(pi) + Float32(pi)) * uy)) * sqrt(Float32(ux * Float32(Float32(Float32(Float32(2.0) - Float32(Float32(ux * Float32(maxCos - Float32(1.0))) * Float32(maxCos - Float32(1.0)))) - maxCos) - maxCos)))) end
function tmp = code(ux, uy, maxCos) tmp = cos(((single(pi) + single(pi)) * uy)) * sqrt((ux * (((single(2.0) - ((ux * (maxCos - single(1.0))) * (maxCos - single(1.0)))) - maxCos) - maxCos))); end
\cos \left(\left(\pi + \pi\right) \cdot uy\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - \left(ux \cdot \left(maxCos - 1\right)\right) \cdot \left(maxCos - 1\right)\right) - maxCos\right) - maxCos\right)}
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift--.f32N/A
lift-*.f32N/A
count-2-revN/A
associate--r+N/A
lower--.f32N/A
lower--.f3299.0%
lift-+.f32N/A
lift-*.f32N/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
metadata-evalN/A
*-lft-identity99.0%
lift-*.f32N/A
lift-pow.f32N/A
unpow2N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f32N/A
count-2-revN/A
lower-+.f3299.0%
Applied rewrites99.0%
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* (* uy 2) PI)) (sqrt (* ux (- (- (- 2 (+ ux (* -2 (* maxCos ux)))) maxCos) maxCos)))))
float code(float ux, float uy, float maxCos) {
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((ux * (((2.0f - (ux + (-2.0f * (maxCos * ux)))) - maxCos) - maxCos)));
}
function code(ux, uy, maxCos) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(Float32(Float32(2.0) - Float32(ux + Float32(Float32(-2.0) * Float32(maxCos * ux)))) - maxCos) - maxCos)))) end
function tmp = code(ux, uy, maxCos) tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt((ux * (((single(2.0) - (ux + (single(-2.0) * (maxCos * ux)))) - maxCos) - maxCos))); end
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - \left(ux + -2 \cdot \left(maxCos \cdot ux\right)\right)\right) - maxCos\right) - maxCos\right)}
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift--.f32N/A
lift-*.f32N/A
count-2-revN/A
associate--r+N/A
lower--.f32N/A
lower--.f3299.0%
lift-+.f32N/A
lift-*.f32N/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
metadata-evalN/A
*-lft-identity99.0%
lift-*.f32N/A
lift-pow.f32N/A
unpow2N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
Taylor expanded in maxCos around 0
lower-+.f32N/A
lower-*.f32N/A
lower-*.f3298.3%
Applied rewrites98.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- 2 (+ (- ux (* (+ maxCos maxCos) ux)) (+ maxCos maxCos))) ux)) (cos (* (+ PI PI) uy))))
float code(float ux, float uy, float maxCos) {
return sqrtf(((2.0f - ((ux - ((maxCos + maxCos) * ux)) + (maxCos + maxCos))) * ux)) * cosf(((((float) M_PI) + ((float) M_PI)) * uy));
}
function code(ux, uy, maxCos) return Float32(sqrt(Float32(Float32(Float32(2.0) - Float32(Float32(ux - Float32(Float32(maxCos + maxCos) * ux)) + Float32(maxCos + maxCos))) * ux)) * cos(Float32(Float32(Float32(pi) + Float32(pi)) * uy))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt(((single(2.0) - ((ux - ((maxCos + maxCos) * ux)) + (maxCos + maxCos))) * ux)) * cos(((single(pi) + single(pi)) * uy)); end
\sqrt{\left(2 - \left(\left(ux - \left(maxCos + maxCos\right) \cdot ux\right) + \left(maxCos + maxCos\right)\right)\right) \cdot ux} \cdot \cos \left(\left(\pi + \pi\right) \cdot uy\right)
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift--.f32N/A
lift-*.f32N/A
count-2-revN/A
associate--r+N/A
lower--.f32N/A
lower--.f3299.0%
lift-+.f32N/A
lift-*.f32N/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
metadata-evalN/A
*-lft-identity99.0%
lift-*.f32N/A
lift-pow.f32N/A
unpow2N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
Taylor expanded in maxCos around 0
lower-+.f32N/A
lower-*.f32N/A
lower-*.f3298.3%
Applied rewrites98.3%
Applied rewrites98.3%
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* (* uy 2) PI)) (sqrt (* ux (- (- (- 2 ux) maxCos) maxCos)))))
float code(float ux, float uy, float maxCos) {
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((ux * (((2.0f - ux) - maxCos) - maxCos)));
}
function code(ux, uy, maxCos) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(Float32(Float32(2.0) - ux) - maxCos) - maxCos)))) end
function tmp = code(ux, uy, maxCos) tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt((ux * (((single(2.0) - ux) - maxCos) - maxCos))); end
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - ux\right) - maxCos\right) - maxCos\right)}
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift--.f32N/A
lift-*.f32N/A
count-2-revN/A
associate--r+N/A
lower--.f32N/A
lower--.f3299.0%
lift-+.f32N/A
lift-*.f32N/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
metadata-evalN/A
*-lft-identity99.0%
lift-*.f32N/A
lift-pow.f32N/A
unpow2N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
Taylor expanded in maxCos around 0
lower-+.f32N/A
lower-*.f32N/A
lower-*.f3298.3%
Applied rewrites98.3%
Taylor expanded in maxCos around 0
lower--.f3297.5%
Applied rewrites97.5%
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* (* uy 2) PI)) (sqrt (* ux (- 2 ux)))))
float code(float ux, float uy, float maxCos) {
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((ux * (2.0f - ux)));
}
function code(ux, uy, maxCos) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux)))) end
function tmp = code(ux, uy, maxCos) tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt((ux * (single(2.0) - ux))); end
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}
Initial program 57.2%
Taylor expanded in ux around 0
lower-*.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
lift--.f32N/A
lift-*.f32N/A
count-2-revN/A
associate--r+N/A
lower--.f32N/A
lower--.f3299.0%
lift-+.f32N/A
lift-*.f32N/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
metadata-evalN/A
*-lft-identity99.0%
lift-*.f32N/A
lift-pow.f32N/A
unpow2N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0%
Applied rewrites99.0%
Taylor expanded in maxCos around 0
lower-+.f32N/A
lower-*.f32N/A
lower-*.f3298.3%
Applied rewrites98.3%
Taylor expanded in maxCos around 0
lower-*.f32N/A
lower--.f3293.0%
Applied rewrites93.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (- -1 (* maxCos ux))))
(sqrt
(-
(- 1 (* t_0 t_0))
(- (* ux ux) (* (* 2 ux) (- (* maxCos ux) -1)))))))float code(float ux, float uy, float maxCos) {
float t_0 = -1.0f - (maxCos * ux);
return sqrtf(((1.0f - (t_0 * t_0)) - ((ux * ux) - ((2.0f * ux) * ((maxCos * ux) - -1.0f)))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
real(4) :: t_0
t_0 = (-1.0e0) - (maxcos * ux)
code = sqrt(((1.0e0 - (t_0 * t_0)) - ((ux * ux) - ((2.0e0 * ux) * ((maxcos * ux) - (-1.0e0))))))
end function
function code(ux, uy, maxCos) t_0 = Float32(Float32(-1.0) - Float32(maxCos * ux)) return sqrt(Float32(Float32(Float32(1.0) - Float32(t_0 * t_0)) - Float32(Float32(ux * ux) - Float32(Float32(Float32(2.0) * ux) * Float32(Float32(maxCos * ux) - Float32(-1.0)))))) end
function tmp = code(ux, uy, maxCos) t_0 = single(-1.0) - (maxCos * ux); tmp = sqrt(((single(1.0) - (t_0 * t_0)) - ((ux * ux) - ((single(2.0) * ux) * ((maxCos * ux) - single(-1.0)))))); end
\begin{array}{l}
t_0 := -1 - maxCos \cdot ux\\
\sqrt{\left(1 - t\_0 \cdot t\_0\right) - \left(ux \cdot ux - \left(2 \cdot ux\right) \cdot \left(maxCos \cdot ux - -1\right)\right)}
\end{array}
Initial program 57.2%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f3249.0%
Applied rewrites49.0%
lift-pow.f32N/A
lift--.f32N/A
sub-square-powN/A
associate-+l-N/A
lower--.f32N/A
unpow2N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f32N/A
lift-+.f32N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f32N/A
unpow2N/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower--.f32N/A
Applied rewrites51.1%
lift--.f32N/A
lift--.f32N/A
associate--r-N/A
add-flipN/A
lower--.f32N/A
Applied rewrites77.3%
(FPCore (ux uy maxCos) :precision binary32 (let* ((t_0 (- (* maxCos ux) ux))) (sqrt (- 1 (- 1 (- (* (- ux (* maxCos ux)) 2) (* t_0 t_0)))))))
float code(float ux, float uy, float maxCos) {
float t_0 = (maxCos * ux) - ux;
return sqrtf((1.0f - (1.0f - (((ux - (maxCos * ux)) * 2.0f) - (t_0 * t_0)))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
real(4) :: t_0
t_0 = (maxcos * ux) - ux
code = sqrt((1.0e0 - (1.0e0 - (((ux - (maxcos * ux)) * 2.0e0) - (t_0 * t_0)))))
end function
function code(ux, uy, maxCos) t_0 = Float32(Float32(maxCos * ux) - ux) return sqrt(Float32(Float32(1.0) - Float32(Float32(1.0) - Float32(Float32(Float32(ux - Float32(maxCos * ux)) * Float32(2.0)) - Float32(t_0 * t_0))))) end
function tmp = code(ux, uy, maxCos) t_0 = (maxCos * ux) - ux; tmp = sqrt((single(1.0) - (single(1.0) - (((ux - (maxCos * ux)) * single(2.0)) - (t_0 * t_0))))); end
\begin{array}{l}
t_0 := maxCos \cdot ux - ux\\
\sqrt{1 - \left(1 - \left(\left(ux - maxCos \cdot ux\right) \cdot 2 - t\_0 \cdot t\_0\right)\right)}
\end{array}
Initial program 57.2%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f3249.0%
Applied rewrites49.0%
lift-pow.f32N/A
lift--.f32N/A
lift-+.f32N/A
associate--l+N/A
add-flip-revN/A
sub-negate-revN/A
lift--.f32N/A
sub-square-pow-revN/A
metadata-evalN/A
lift-*.f32N/A
lift-*.f32N/A
pow2N/A
lift-*.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3251.4%
Applied rewrites51.4%
(FPCore (ux uy maxCos) :precision binary32 (let* ((t_0 (- (* maxCos ux) -1))) (sqrt (- 1 (- (* t_0 t_0) (- (* 2 ux) (* ux ux)))))))
float code(float ux, float uy, float maxCos) {
float t_0 = (maxCos * ux) - -1.0f;
return sqrtf((1.0f - ((t_0 * t_0) - ((2.0f * ux) - (ux * ux)))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
real(4) :: t_0
t_0 = (maxcos * ux) - (-1.0e0)
code = sqrt((1.0e0 - ((t_0 * t_0) - ((2.0e0 * ux) - (ux * ux)))))
end function
function code(ux, uy, maxCos) t_0 = Float32(Float32(maxCos * ux) - Float32(-1.0)) return sqrt(Float32(Float32(1.0) - Float32(Float32(t_0 * t_0) - Float32(Float32(Float32(2.0) * ux) - Float32(ux * ux))))) end
function tmp = code(ux, uy, maxCos) t_0 = (maxCos * ux) - single(-1.0); tmp = sqrt((single(1.0) - ((t_0 * t_0) - ((single(2.0) * ux) - (ux * ux))))); end
\begin{array}{l}
t_0 := maxCos \cdot ux - -1\\
\sqrt{1 - \left(t\_0 \cdot t\_0 - \left(2 \cdot ux - ux \cdot ux\right)\right)}
\end{array}
Initial program 57.2%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f3249.0%
Applied rewrites49.0%
lift-pow.f32N/A
lift--.f32N/A
sub-square-powN/A
associate-+l-N/A
lower--.f32N/A
unpow2N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f32N/A
lift-+.f32N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f32N/A
unpow2N/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower--.f32N/A
Applied rewrites51.1%
Taylor expanded in ux around 0
lower-*.f3250.5%
Applied rewrites50.5%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (+ (* (- (- ux (* maxCos ux)) 1) (- (* maxCos ux) (+ -1 ux))) 1)))
float code(float ux, float uy, float maxCos) {
return sqrtf(((((ux - (maxCos * ux)) - 1.0f) * ((maxCos * ux) - (-1.0f + ux))) + 1.0f));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt(((((ux - (maxcos * ux)) - 1.0e0) * ((maxcos * ux) - ((-1.0e0) + ux))) + 1.0e0))
end function
function code(ux, uy, maxCos) return sqrt(Float32(Float32(Float32(Float32(ux - Float32(maxCos * ux)) - Float32(1.0)) * Float32(Float32(maxCos * ux) - Float32(Float32(-1.0) + ux))) + Float32(1.0))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt(((((ux - (maxCos * ux)) - single(1.0)) * ((maxCos * ux) - (single(-1.0) + ux))) + single(1.0))); end
\sqrt{\left(\left(ux - maxCos \cdot ux\right) - 1\right) \cdot \left(maxCos \cdot ux - \left(-1 + ux\right)\right) + 1}
Initial program 57.2%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f3249.0%
Applied rewrites49.0%
lift-pow.f32N/A
lift--.f32N/A
sub-square-powN/A
associate-+l-N/A
lower--.f32N/A
unpow2N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f32N/A
lift-+.f32N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f32N/A
unpow2N/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower--.f32N/A
Applied rewrites51.1%
Applied rewrites49.2%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (- 1 (- (* (- (+ maxCos maxCos) 2) ux) -1))))
float code(float ux, float uy, float maxCos) {
return sqrtf((1.0f - ((((maxCos + maxCos) - 2.0f) * ux) - -1.0f)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((1.0e0 - ((((maxcos + maxcos) - 2.0e0) * ux) - (-1.0e0))))
end function
function code(ux, uy, maxCos) return sqrt(Float32(Float32(1.0) - Float32(Float32(Float32(Float32(maxCos + maxCos) - Float32(2.0)) * ux) - Float32(-1.0)))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((single(1.0) - ((((maxCos + maxCos) - single(2.0)) * ux) - single(-1.0)))); end
\sqrt{1 - \left(\left(\left(maxCos + maxCos\right) - 2\right) \cdot ux - -1\right)}
Initial program 57.2%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f3249.0%
Applied rewrites49.0%
Taylor expanded in ux around 0
lower-+.f32N/A
lower-*.f32N/A
lower--.f32N/A
lower-*.f3240.0%
Applied rewrites40.0%
lift-+.f32N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f3240.0%
lift-*.f32N/A
*-commutativeN/A
lower-*.f3240.0%
lift-*.f32N/A
count-2-revN/A
lift-+.f3240.0%
Applied rewrites40.0%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (- 1 (+ 1 (* ux -2)))))
float code(float ux, float uy, float maxCos) {
return sqrtf((1.0f - (1.0f + (ux * -2.0f))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((1.0e0 - (1.0e0 + (ux * (-2.0e0)))))
end function
function code(ux, uy, maxCos) return sqrt(Float32(Float32(1.0) - Float32(Float32(1.0) + Float32(ux * Float32(-2.0))))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((single(1.0) - (single(1.0) + (ux * single(-2.0))))); end
\sqrt{1 - \left(1 + ux \cdot -2\right)}
Initial program 57.2%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f3249.0%
Applied rewrites49.0%
Taylor expanded in ux around 0
lower-+.f32N/A
lower-*.f32N/A
lower--.f32N/A
lower-*.f3240.0%
Applied rewrites40.0%
Taylor expanded in maxCos around 0
Applied rewrites39.4%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (- 1 1)))
float code(float ux, float uy, float maxCos) {
return sqrtf((1.0f - 1.0f));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(4) function code(ux, uy, maxcos)
use fmin_fmax_functions
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((1.0e0 - 1.0e0))
end function
function code(ux, uy, maxCos) return sqrt(Float32(Float32(1.0) - Float32(1.0))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((single(1.0) - single(1.0))); end
\sqrt{1 - 1}
Initial program 57.2%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
lower-pow.f32N/A
lower--.f32N/A
lower-+.f32N/A
lower-*.f3249.0%
Applied rewrites49.0%
Taylor expanded in ux around 0
lower-+.f32N/A
lower-*.f32N/A
lower--.f32N/A
lower-*.f3240.0%
Applied rewrites40.0%
Taylor expanded in ux around 0
Applied rewrites6.6%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (ux uy maxCos)
:name "UniformSampleCone, x"
:precision binary32
:pre (and (and (and (<= 2328306437/10000000000000000000 ux) (<= ux 1)) (and (<= 2328306437/10000000000000000000 uy) (<= uy 1))) (and (<= 0 maxCos) (<= maxCos 1)))
(* (cos (* (* uy 2) PI)) (sqrt (- 1 (* (+ (- 1 ux) (* ux maxCos)) (+ (- 1 ux) (* ux maxCos)))))))