
(FPCore (s r) :precision binary32 (+ (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r)) (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r))))
float code(float s, float r) {
return ((0.25f * expf((-r / s))) / (((2.0f * ((float) M_PI)) * s) * r)) + ((0.75f * expf((-r / (3.0f * s)))) / (((6.0f * ((float) M_PI)) * s) * r));
}
function code(s, r) return Float32(Float32(Float32(Float32(0.25) * exp(Float32(Float32(-r) / s))) / Float32(Float32(Float32(Float32(2.0) * Float32(pi)) * s) * r)) + Float32(Float32(Float32(0.75) * exp(Float32(Float32(-r) / Float32(Float32(3.0) * s)))) / Float32(Float32(Float32(Float32(6.0) * Float32(pi)) * s) * r))) end
function tmp = code(s, r) tmp = ((single(0.25) * exp((-r / s))) / (((single(2.0) * single(pi)) * s) * r)) + ((single(0.75) * exp((-r / (single(3.0) * s)))) / (((single(6.0) * single(pi)) * s) * r)); end
\begin{array}{l}
\\
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (s r) :precision binary32 (+ (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r)) (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r))))
float code(float s, float r) {
return ((0.25f * expf((-r / s))) / (((2.0f * ((float) M_PI)) * s) * r)) + ((0.75f * expf((-r / (3.0f * s)))) / (((6.0f * ((float) M_PI)) * s) * r));
}
function code(s, r) return Float32(Float32(Float32(Float32(0.25) * exp(Float32(Float32(-r) / s))) / Float32(Float32(Float32(Float32(2.0) * Float32(pi)) * s) * r)) + Float32(Float32(Float32(0.75) * exp(Float32(Float32(-r) / Float32(Float32(3.0) * s)))) / Float32(Float32(Float32(Float32(6.0) * Float32(pi)) * s) * r))) end
function tmp = code(s, r) tmp = ((single(0.25) * exp((-r / s))) / (((single(2.0) * single(pi)) * s) * r)) + ((single(0.75) * exp((-r / (single(3.0) * s)))) / (((single(6.0) * single(pi)) * s) * r)); end
\begin{array}{l}
\\
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\end{array}
(FPCore (s r) :precision binary32 (+ (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r)) (/ (* 0.75 (exp (/ (/ (- r) 3.0) s))) (* (* (* 6.0 PI) s) r))))
float code(float s, float r) {
return ((0.25f * expf((-r / s))) / (((2.0f * ((float) M_PI)) * s) * r)) + ((0.75f * expf(((-r / 3.0f) / s))) / (((6.0f * ((float) M_PI)) * s) * r));
}
function code(s, r) return Float32(Float32(Float32(Float32(0.25) * exp(Float32(Float32(-r) / s))) / Float32(Float32(Float32(Float32(2.0) * Float32(pi)) * s) * r)) + Float32(Float32(Float32(0.75) * exp(Float32(Float32(Float32(-r) / Float32(3.0)) / s))) / Float32(Float32(Float32(Float32(6.0) * Float32(pi)) * s) * r))) end
function tmp = code(s, r) tmp = ((single(0.25) * exp((-r / s))) / (((single(2.0) * single(pi)) * s) * r)) + ((single(0.75) * exp(((-r / single(3.0)) / s))) / (((single(6.0) * single(pi)) * s) * r)); end
\begin{array}{l}
\\
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{\frac{-r}{3}}{s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\end{array}
Initial program 99.6%
lift-*.f32N/A
lift-/.f32N/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f3299.6
Applied rewrites99.6%
(FPCore (s r) :precision binary32 (fma 0.75 (/ (exp (/ (- r) (* 3.0 s))) (* (* (* 6.0 PI) s) r)) (* (/ (exp (/ (- r) s)) (* (* PI s) r)) 0.125)))
float code(float s, float r) {
return fmaf(0.75f, (expf((-r / (3.0f * s))) / (((6.0f * ((float) M_PI)) * s) * r)), ((expf((-r / s)) / ((((float) M_PI) * s) * r)) * 0.125f));
}
function code(s, r) return fma(Float32(0.75), Float32(exp(Float32(Float32(-r) / Float32(Float32(3.0) * s))) / Float32(Float32(Float32(Float32(6.0) * Float32(pi)) * s) * r)), Float32(Float32(exp(Float32(Float32(-r) / s)) / Float32(Float32(Float32(pi) * s) * r)) * Float32(0.125))) end
\begin{array}{l}
\\
\mathsf{fma}\left(0.75, \frac{e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}, \frac{e^{\frac{-r}{s}}}{\left(\pi \cdot s\right) \cdot r} \cdot 0.125\right)
\end{array}
Initial program 99.6%
Taylor expanded in s around 0
*-commutativeN/A
lower-*.f32N/A
mul-1-negN/A
distribute-frac-negN/A
lower-/.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f3299.6
Applied rewrites99.6%
lift-+.f32N/A
lift-/.f32N/A
lift-*.f32N/A
lift-exp.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-neg.f32N/A
lift-*.f32N/A
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
Applied rewrites99.6%
(FPCore (s r)
:precision binary32
(/
(*
0.125
(+
(/ (exp (/ (- r) s)) (* PI s))
(/ (exp (* (/ r s) -0.3333333333333333)) (* PI s))))
r))
float code(float s, float r) {
return (0.125f * ((expf((-r / s)) / (((float) M_PI) * s)) + (expf(((r / s) * -0.3333333333333333f)) / (((float) M_PI) * s)))) / r;
}
function code(s, r) return Float32(Float32(Float32(0.125) * Float32(Float32(exp(Float32(Float32(-r) / s)) / Float32(Float32(pi) * s)) + Float32(exp(Float32(Float32(r / s) * Float32(-0.3333333333333333))) / Float32(Float32(pi) * s)))) / r) end
function tmp = code(s, r) tmp = (single(0.125) * ((exp((-r / s)) / (single(pi) * s)) + (exp(((r / s) * single(-0.3333333333333333))) / (single(pi) * s)))) / r; end
\begin{array}{l}
\\
\frac{0.125 \cdot \left(\frac{e^{\frac{-r}{s}}}{\pi \cdot s} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{\pi \cdot s}\right)}{r}
\end{array}
Initial program 99.6%
Taylor expanded in r around inf
lower-/.f32N/A
Applied rewrites99.5%
Applied rewrites99.5%
(FPCore (s r)
:precision binary32
(/
(*
0.125
(+
(/ (exp (/ (- r) s)) (* PI r))
(/ (exp (* -0.3333333333333333 (/ r s))) (* PI r))))
s))
float code(float s, float r) {
return (0.125f * ((expf((-r / s)) / (((float) M_PI) * r)) + (expf((-0.3333333333333333f * (r / s))) / (((float) M_PI) * r)))) / s;
}
function code(s, r) return Float32(Float32(Float32(0.125) * Float32(Float32(exp(Float32(Float32(-r) / s)) / Float32(Float32(pi) * r)) + Float32(exp(Float32(Float32(-0.3333333333333333) * Float32(r / s))) / Float32(Float32(pi) * r)))) / s) end
function tmp = code(s, r) tmp = (single(0.125) * ((exp((-r / s)) / (single(pi) * r)) + (exp((single(-0.3333333333333333) * (r / s))) / (single(pi) * r)))) / s; end
\begin{array}{l}
\\
\frac{0.125 \cdot \left(\frac{e^{\frac{-r}{s}}}{\pi \cdot r} + \frac{e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\pi \cdot r}\right)}{s}
\end{array}
Initial program 99.6%
Taylor expanded in s around 0
lower-/.f32N/A
Applied rewrites99.5%
(FPCore (s r)
:precision binary32
(/
(/
(-
(* 0.125 (exp (/ (- r) s)))
(* -0.125 (exp (/ (* -0.3333333333333333 r) s))))
(* PI s))
r))
float code(float s, float r) {
return (((0.125f * expf((-r / s))) - (-0.125f * expf(((-0.3333333333333333f * r) / s)))) / (((float) M_PI) * s)) / r;
}
function code(s, r) return Float32(Float32(Float32(Float32(Float32(0.125) * exp(Float32(Float32(-r) / s))) - Float32(Float32(-0.125) * exp(Float32(Float32(Float32(-0.3333333333333333) * r) / s)))) / Float32(Float32(pi) * s)) / r) end
function tmp = code(s, r) tmp = (((single(0.125) * exp((-r / s))) - (single(-0.125) * exp(((single(-0.3333333333333333) * r) / s)))) / (single(pi) * s)) / r; end
\begin{array}{l}
\\
\frac{\frac{0.125 \cdot e^{\frac{-r}{s}} - -0.125 \cdot e^{\frac{-0.3333333333333333 \cdot r}{s}}}{\pi \cdot s}}{r}
\end{array}
Initial program 99.6%
Taylor expanded in r around inf
lower-/.f32N/A
Applied rewrites99.5%
lift-*.f32N/A
lift-/.f32N/A
associate-*r/N/A
lower-/.f32N/A
lower-*.f3299.5
Applied rewrites99.5%
(FPCore (s r) :precision binary32 (* (/ 0.125 (* PI s)) (/ (+ (exp (* (/ r s) -0.3333333333333333)) (exp (/ (- r) s))) r)))
float code(float s, float r) {
return (0.125f / (((float) M_PI) * s)) * ((expf(((r / s) * -0.3333333333333333f)) + expf((-r / s))) / r);
}
function code(s, r) return Float32(Float32(Float32(0.125) / Float32(Float32(pi) * s)) * Float32(Float32(exp(Float32(Float32(r / s) * Float32(-0.3333333333333333))) + exp(Float32(Float32(-r) / s))) / r)) end
function tmp = code(s, r) tmp = (single(0.125) / (single(pi) * s)) * ((exp(((r / s) * single(-0.3333333333333333))) + exp((-r / s))) / r); end
\begin{array}{l}
\\
\frac{0.125}{\pi \cdot s} \cdot \frac{e^{\frac{r}{s} \cdot -0.3333333333333333} + e^{\frac{-r}{s}}}{r}
\end{array}
Initial program 99.6%
Taylor expanded in r around inf
lower-/.f32N/A
Applied rewrites99.5%
Applied rewrites99.5%
lift-exp.f32N/A
lift-/.f32N/A
lift-neg.f32N/A
lift-*.f32N/A
lift-exp.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lower-fma.f32N/A
distribute-lft-outN/A
distribute-frac-negN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f32N/A
mul-1-negN/A
distribute-frac-negN/A
Applied rewrites99.5%
lift-/.f32N/A
lift-*.f32N/A
lift-+.f32N/A
lift-exp.f32N/A
lift-/.f32N/A
lift-neg.f32N/A
lift-exp.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
times-fracN/A
Applied rewrites99.5%
(FPCore (s r) :precision binary32 (/ (* 0.125 (+ (exp (/ (- r) s)) (exp (/ (* -0.3333333333333333 r) s)))) (* (* PI s) r)))
float code(float s, float r) {
return (0.125f * (expf((-r / s)) + expf(((-0.3333333333333333f * r) / s)))) / ((((float) M_PI) * s) * r);
}
function code(s, r) return Float32(Float32(Float32(0.125) * Float32(exp(Float32(Float32(-r) / s)) + exp(Float32(Float32(Float32(-0.3333333333333333) * r) / s)))) / Float32(Float32(Float32(pi) * s) * r)) end
function tmp = code(s, r) tmp = (single(0.125) * (exp((-r / s)) + exp(((single(-0.3333333333333333) * r) / s)))) / ((single(pi) * s) * r); end
\begin{array}{l}
\\
\frac{0.125 \cdot \left(e^{\frac{-r}{s}} + e^{\frac{-0.3333333333333333 \cdot r}{s}}\right)}{\left(\pi \cdot s\right) \cdot r}
\end{array}
Initial program 99.6%
Taylor expanded in r around inf
lower-/.f32N/A
Applied rewrites99.5%
Applied rewrites99.5%
lift-exp.f32N/A
lift-/.f32N/A
lift-neg.f32N/A
lift-*.f32N/A
lift-exp.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lower-fma.f32N/A
distribute-lft-outN/A
distribute-frac-negN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f32N/A
mul-1-negN/A
distribute-frac-negN/A
Applied rewrites99.5%
lift-*.f32N/A
lift-/.f32N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f32N/A
lower-*.f3299.5
Applied rewrites99.5%
(FPCore (s r) :precision binary32 (/ (* 0.125 (+ (exp (/ (- r) s)) (exp (* (/ r s) -0.3333333333333333)))) (* (* PI s) r)))
float code(float s, float r) {
return (0.125f * (expf((-r / s)) + expf(((r / s) * -0.3333333333333333f)))) / ((((float) M_PI) * s) * r);
}
function code(s, r) return Float32(Float32(Float32(0.125) * Float32(exp(Float32(Float32(-r) / s)) + exp(Float32(Float32(r / s) * Float32(-0.3333333333333333))))) / Float32(Float32(Float32(pi) * s) * r)) end
function tmp = code(s, r) tmp = (single(0.125) * (exp((-r / s)) + exp(((r / s) * single(-0.3333333333333333))))) / ((single(pi) * s) * r); end
\begin{array}{l}
\\
\frac{0.125 \cdot \left(e^{\frac{-r}{s}} + e^{\frac{r}{s} \cdot -0.3333333333333333}\right)}{\left(\pi \cdot s\right) \cdot r}
\end{array}
Initial program 99.6%
Taylor expanded in r around inf
lower-/.f32N/A
Applied rewrites99.5%
Applied rewrites99.5%
lift-exp.f32N/A
lift-/.f32N/A
lift-neg.f32N/A
lift-*.f32N/A
lift-exp.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lower-fma.f32N/A
distribute-lft-outN/A
distribute-frac-negN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f32N/A
mul-1-negN/A
distribute-frac-negN/A
Applied rewrites99.5%
(FPCore (s r) :precision binary32 (/ (* 0.125 (+ (exp (/ (- r) s)) (exp (* (/ r s) -0.3333333333333333)))) (* (* PI r) s)))
float code(float s, float r) {
return (0.125f * (expf((-r / s)) + expf(((r / s) * -0.3333333333333333f)))) / ((((float) M_PI) * r) * s);
}
function code(s, r) return Float32(Float32(Float32(0.125) * Float32(exp(Float32(Float32(-r) / s)) + exp(Float32(Float32(r / s) * Float32(-0.3333333333333333))))) / Float32(Float32(Float32(pi) * r) * s)) end
function tmp = code(s, r) tmp = (single(0.125) * (exp((-r / s)) + exp(((r / s) * single(-0.3333333333333333))))) / ((single(pi) * r) * s); end
\begin{array}{l}
\\
\frac{0.125 \cdot \left(e^{\frac{-r}{s}} + e^{\frac{r}{s} \cdot -0.3333333333333333}\right)}{\left(\pi \cdot r\right) \cdot s}
\end{array}
Initial program 99.6%
Taylor expanded in r around inf
lower-/.f32N/A
Applied rewrites99.5%
Applied rewrites99.5%
lift-exp.f32N/A
lift-/.f32N/A
lift-neg.f32N/A
lift-*.f32N/A
lift-exp.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lower-fma.f32N/A
distribute-lft-outN/A
distribute-frac-negN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f32N/A
mul-1-negN/A
distribute-frac-negN/A
Applied rewrites99.5%
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f32N/A
lift-PI.f32N/A
*-commutativeN/A
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-PI.f3299.5
Applied rewrites99.5%
(FPCore (s r) :precision binary32 (/ 0.25 (* s (log (pow (exp PI) r)))))
float code(float s, float r) {
return 0.25f / (s * logf(powf(expf(((float) M_PI)), r)));
}
function code(s, r) return Float32(Float32(0.25) / Float32(s * log((exp(Float32(pi)) ^ r)))) end
function tmp = code(s, r) tmp = single(0.25) / (s * log((exp(single(pi)) ^ r))); end
\begin{array}{l}
\\
\frac{0.25}{s \cdot \log \left({\left(e^{\pi}\right)}^{r}\right)}
\end{array}
Initial program 99.6%
Taylor expanded in s around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
add-log-expN/A
log-pow-revN/A
lower-log.f32N/A
lower-pow.f32N/A
lower-exp.f32N/A
lift-PI.f3244.0
Applied rewrites44.0%
(FPCore (s r) :precision binary32 (/ 0.25 (* (* PI s) (log (exp r)))))
float code(float s, float r) {
return 0.25f / ((((float) M_PI) * s) * logf(expf(r)));
}
function code(s, r) return Float32(Float32(0.25) / Float32(Float32(Float32(pi) * s) * log(exp(r)))) end
function tmp = code(s, r) tmp = single(0.25) / ((single(pi) * s) * log(exp(r))); end
\begin{array}{l}
\\
\frac{0.25}{\left(\pi \cdot s\right) \cdot \log \left(e^{r}\right)}
\end{array}
Initial program 99.6%
Taylor expanded in s around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-PI.f32N/A
lift-*.f32N/A
add-log-expN/A
lift-exp.f32N/A
lift-PI.f32N/A
log-powN/A
lift-PI.f32N/A
lift-exp.f32N/A
lift-*.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
pow-unpowN/A
pow-to-expN/A
log-pow-revN/A
lift-PI.f32N/A
lift-exp.f32N/A
add-log-expN/A
*-commutativeN/A
exp-prodN/A
Applied rewrites40.5%
(FPCore (s r) :precision binary32 (/ 0.25 (log (exp (* (* PI s) r)))))
float code(float s, float r) {
return 0.25f / logf(expf(((((float) M_PI) * s) * r)));
}
function code(s, r) return Float32(Float32(0.25) / log(exp(Float32(Float32(Float32(pi) * s) * r)))) end
function tmp = code(s, r) tmp = single(0.25) / log(exp(((single(pi) * s) * r))); end
\begin{array}{l}
\\
\frac{0.25}{\log \left(e^{\left(\pi \cdot s\right) \cdot r}\right)}
\end{array}
Initial program 99.6%
Taylor expanded in s around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
add-log-expN/A
log-pow-revN/A
lower-log.f32N/A
lower-pow.f32N/A
lower-exp.f32N/A
lift-PI.f32N/A
*-commutativeN/A
lower-*.f3210.4
Applied rewrites10.4%
lift-pow.f32N/A
lift-*.f32N/A
pow-unpowN/A
pow-to-expN/A
log-pow-revN/A
lift-PI.f32N/A
lift-exp.f32N/A
add-log-expN/A
*-commutativeN/A
lower-exp.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-PI.f32N/A
*-commutativeN/A
lift-*.f3210.4
Applied rewrites10.4%
(FPCore (s r) :precision binary32 (/ (/ 0.25 (* s r)) PI))
float code(float s, float r) {
return (0.25f / (s * r)) / ((float) M_PI);
}
function code(s, r) return Float32(Float32(Float32(0.25) / Float32(s * r)) / Float32(pi)) end
function tmp = code(s, r) tmp = (single(0.25) / (s * r)) / single(pi); end
\begin{array}{l}
\\
\frac{\frac{0.25}{s \cdot r}}{\pi}
\end{array}
Initial program 99.6%
Taylor expanded in s around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-/.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
(FPCore (s r) :precision binary32 (/ 0.25 (* (* PI s) r)))
float code(float s, float r) {
return 0.25f / ((((float) M_PI) * s) * r);
}
function code(s, r) return Float32(Float32(0.25) / Float32(Float32(Float32(pi) * s) * r)) end
function tmp = code(s, r) tmp = single(0.25) / ((single(pi) * s) * r); end
\begin{array}{l}
\\
\frac{0.25}{\left(\pi \cdot s\right) \cdot r}
\end{array}
Initial program 99.6%
Taylor expanded in s around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
(FPCore (s r) :precision binary32 (/ 0.25 (* (* s r) PI)))
float code(float s, float r) {
return 0.25f / ((s * r) * ((float) M_PI));
}
function code(s, r) return Float32(Float32(0.25) / Float32(Float32(s * r) * Float32(pi))) end
function tmp = code(s, r) tmp = single(0.25) / ((s * r) * single(pi)); end
\begin{array}{l}
\\
\frac{0.25}{\left(s \cdot r\right) \cdot \pi}
\end{array}
Initial program 99.6%
Taylor expanded in s around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
(FPCore (s r) :precision binary32 (/ 0.25 (* s (* PI r))))
float code(float s, float r) {
return 0.25f / (s * (((float) M_PI) * r));
}
function code(s, r) return Float32(Float32(0.25) / Float32(s * Float32(Float32(pi) * r))) end
function tmp = code(s, r) tmp = single(0.25) / (s * (single(pi) * r)); end
\begin{array}{l}
\\
\frac{0.25}{s \cdot \left(\pi \cdot r\right)}
\end{array}
Initial program 99.6%
Taylor expanded in s around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-PI.f329.0
Applied rewrites9.0%
herbie shell --seed 2025113
(FPCore (s r)
:name "Disney BSSRDF, PDF of scattering profile"
:precision binary32
:pre (and (and (<= 0.0 s) (<= s 256.0)) (and (< 1e-6 r) (< r 1000000.0)))
(+ (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r)) (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r))))