Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.5% → 99.5%
Time: 5.7s
Alternatives: 22
Speedup: N/A×

Specification

?
\[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
\[\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} \]
(FPCore (s r)
  :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))))
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
\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}

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 22 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: 99.5% accurate, 1.0× speedup?

\[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
\[\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} \]
(FPCore (s r)
  :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))))
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
\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}

Alternative 1: 99.5% accurate, 1.2× speedup?

\[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
\[\frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi \cdot s}, 0.125, \frac{0.125}{\left(\pi \cdot s\right) \cdot e^{\frac{r}{s}}}\right)}{r} \]
(FPCore (s r)
  :precision binary32
  :pre (and (and (<= 0.0 s) (<= s 256.0))
     (and (< 1e-6 r) (< r 1000000.0)))
  (/
 (fma
  (/ (exp (/ r (* -3.0 s))) (* PI s))
  0.125
  (/ 0.125 (* (* PI s) (exp (/ r s)))))
 r))
float code(float s, float r) {
	return fmaf((expf((r / (-3.0f * s))) / (((float) M_PI) * s)), 0.125f, (0.125f / ((((float) M_PI) * s) * expf((r / s))))) / r;
}
function code(s, r)
	return Float32(fma(Float32(exp(Float32(r / Float32(Float32(-3.0) * s))) / Float32(Float32(pi) * s)), Float32(0.125), Float32(Float32(0.125) / Float32(Float32(Float32(pi) * s) * exp(Float32(r / s))))) / r)
end
\frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi \cdot s}, 0.125, \frac{0.125}{\left(\pi \cdot s\right) \cdot e^{\frac{r}{s}}}\right)}{r}
Derivation
  1. Initial program 99.5%

    \[\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} \]
  2. Applied rewrites99.5%

    \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi \cdot s}, 0.125, \frac{0.125}{\left(\pi \cdot s\right) \cdot e^{\frac{r}{s}}}\right)}{r} \]
  3. Add Preprocessing

Alternative 2: 99.5% accurate, 1.3× speedup?

\[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
\[\frac{1}{\frac{r}{\frac{0.125 \cdot \frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{s}}} \]
(FPCore (s r)
  :precision binary32
  :pre (and (and (<= 0.0 s) (<= s 256.0))
     (and (< 1e-6 r) (< r 1000000.0)))
  (/
 1.0
 (/
  r
  (/
   (* 0.125 (/ (+ (exp (/ r (* -3.0 s))) (exp (/ (- r) s))) PI))
   s))))
float code(float s, float r) {
	return 1.0f / (r / ((0.125f * ((expf((r / (-3.0f * s))) + expf((-r / s))) / ((float) M_PI))) / s));
}
function code(s, r)
	return Float32(Float32(1.0) / Float32(r / Float32(Float32(Float32(0.125) * Float32(Float32(exp(Float32(r / Float32(Float32(-3.0) * s))) + exp(Float32(Float32(-r) / s))) / Float32(pi))) / s)))
end
function tmp = code(s, r)
	tmp = single(1.0) / (r / ((single(0.125) * ((exp((r / (single(-3.0) * s))) + exp((-r / s))) / single(pi))) / s));
end
\frac{1}{\frac{r}{\frac{0.125 \cdot \frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{s}}}
Derivation
  1. Initial program 99.5%

    \[\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} \]
  2. Step-by-step derivation
    1. Applied rewrites99.5%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
    2. Step-by-step derivation
      1. Applied rewrites99.5%

        \[\leadsto \frac{1}{\frac{r}{\frac{0.125 \cdot \frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{s}}} \]
      2. Add Preprocessing

      Alternative 3: 99.5% accurate, 1.3× speedup?

      \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
      \[\frac{\frac{\mathsf{fma}\left(e^{\frac{r}{-3 \cdot s}}, 0.125, \frac{0.125}{e^{\frac{r}{s}}}\right)}{\pi \cdot s}}{r} \]
      (FPCore (s r)
        :precision binary32
        :pre (and (and (<= 0.0 s) (<= s 256.0))
           (and (< 1e-6 r) (< r 1000000.0)))
        (/
       (/
        (fma (exp (/ r (* -3.0 s))) 0.125 (/ 0.125 (exp (/ r s))))
        (* PI s))
       r))
      float code(float s, float r) {
      	return (fmaf(expf((r / (-3.0f * s))), 0.125f, (0.125f / expf((r / s)))) / (((float) M_PI) * s)) / r;
      }
      
      function code(s, r)
      	return Float32(Float32(fma(exp(Float32(r / Float32(Float32(-3.0) * s))), Float32(0.125), Float32(Float32(0.125) / exp(Float32(r / s)))) / Float32(Float32(pi) * s)) / r)
      end
      
      \frac{\frac{\mathsf{fma}\left(e^{\frac{r}{-3 \cdot s}}, 0.125, \frac{0.125}{e^{\frac{r}{s}}}\right)}{\pi \cdot s}}{r}
      
      Derivation
      1. Initial program 99.5%

        \[\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} \]
      2. Applied rewrites99.5%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi \cdot s}, 0.125, \frac{0.125}{\left(\pi \cdot s\right) \cdot e^{\frac{r}{s}}}\right)}{r} \]
      3. Step-by-step derivation
        1. Applied rewrites99.5%

          \[\leadsto \frac{\frac{\mathsf{fma}\left(e^{\frac{r}{-3 \cdot s}}, 0.125, \frac{0.125}{e^{\frac{r}{s}}}\right)}{\pi \cdot s}}{r} \]
        2. Add Preprocessing

        Alternative 4: 99.5% accurate, 1.4× speedup?

        \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
        \[\frac{\left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot -0.125}{\left(\pi \cdot r\right) \cdot \left(-s\right)} \]
        (FPCore (s r)
          :precision binary32
          :pre (and (and (<= 0.0 s) (<= s 256.0))
             (and (< 1e-6 r) (< r 1000000.0)))
          (/
         (* (+ (exp (/ r (* -3.0 s))) (exp (/ (- r) s))) -0.125)
         (* (* PI r) (- s))))
        float code(float s, float r) {
        	return ((expf((r / (-3.0f * s))) + expf((-r / s))) * -0.125f) / ((((float) M_PI) * r) * -s);
        }
        
        function code(s, r)
        	return Float32(Float32(Float32(exp(Float32(r / Float32(Float32(-3.0) * s))) + exp(Float32(Float32(-r) / s))) * Float32(-0.125)) / Float32(Float32(Float32(pi) * r) * Float32(-s)))
        end
        
        function tmp = code(s, r)
        	tmp = ((exp((r / (single(-3.0) * s))) + exp((-r / s))) * single(-0.125)) / ((single(pi) * r) * -s);
        end
        
        \frac{\left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot -0.125}{\left(\pi \cdot r\right) \cdot \left(-s\right)}
        
        Derivation
        1. Initial program 99.5%

          \[\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} \]
        2. Step-by-step derivation
          1. Applied rewrites99.5%

            \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
          2. Step-by-step derivation
            1. Applied rewrites99.5%

              \[\leadsto \frac{0.125}{s} \cdot \frac{\frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{r} \]
            2. Step-by-step derivation
              1. Applied rewrites99.5%

                \[\leadsto \frac{\left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot -0.125}{\left(\pi \cdot r\right) \cdot \left(-s\right)} \]
              2. Add Preprocessing

              Alternative 5: 99.5% accurate, 1.4× speedup?

              \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
              \[\frac{\left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot -0.125}{\pi \cdot \left(r \cdot \left(-s\right)\right)} \]
              (FPCore (s r)
                :precision binary32
                :pre (and (and (<= 0.0 s) (<= s 256.0))
                   (and (< 1e-6 r) (< r 1000000.0)))
                (/
               (* (+ (exp (/ r (* -3.0 s))) (exp (/ (- r) s))) -0.125)
               (* PI (* r (- s)))))
              float code(float s, float r) {
              	return ((expf((r / (-3.0f * s))) + expf((-r / s))) * -0.125f) / (((float) M_PI) * (r * -s));
              }
              
              function code(s, r)
              	return Float32(Float32(Float32(exp(Float32(r / Float32(Float32(-3.0) * s))) + exp(Float32(Float32(-r) / s))) * Float32(-0.125)) / Float32(Float32(pi) * Float32(r * Float32(-s))))
              end
              
              function tmp = code(s, r)
              	tmp = ((exp((r / (single(-3.0) * s))) + exp((-r / s))) * single(-0.125)) / (single(pi) * (r * -s));
              end
              
              \frac{\left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot -0.125}{\pi \cdot \left(r \cdot \left(-s\right)\right)}
              
              Derivation
              1. Initial program 99.5%

                \[\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} \]
              2. Step-by-step derivation
                1. Applied rewrites99.5%

                  \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
                2. Step-by-step derivation
                  1. Applied rewrites99.5%

                    \[\leadsto \frac{0.125}{s} \cdot \frac{\frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{r} \]
                  2. Step-by-step derivation
                    1. Applied rewrites99.5%

                      \[\leadsto \frac{\left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot -0.125}{\left(\pi \cdot r\right) \cdot \left(-s\right)} \]
                    2. Step-by-step derivation
                      1. Applied rewrites99.5%

                        \[\leadsto \frac{\left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot -0.125}{\pi \cdot \left(r \cdot \left(-s\right)\right)} \]
                      2. Add Preprocessing

                      Alternative 6: 99.5% accurate, 1.4× speedup?

                      \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                      \[\frac{0.125 \cdot \frac{e^{\frac{-r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\pi \cdot s}}{r} \]
                      (FPCore (s r)
                        :precision binary32
                        :pre (and (and (<= 0.0 s) (<= s 256.0))
                           (and (< 1e-6 r) (< r 1000000.0)))
                        (/
                       (*
                        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(Float32(exp(Float32(Float32(-r) / s)) + exp(Float32(Float32(-0.3333333333333333) * Float32(r / s)))) / 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
                      
                      \frac{0.125 \cdot \frac{e^{\frac{-r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\pi \cdot s}}{r}
                      
                      Derivation
                      1. Initial program 99.5%

                        \[\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} \]
                      2. Taylor expanded in r around inf

                        \[\leadsto \frac{\frac{1}{8} \cdot \frac{e^{-1 \cdot \frac{r}{s}}}{s \cdot \pi} + \frac{1}{8} \cdot \frac{e^{\frac{-1}{3} \cdot \frac{r}{s}}}{s \cdot \pi}}{r} \]
                      3. Step-by-step derivation
                        1. Applied rewrites99.5%

                          \[\leadsto \frac{\mathsf{fma}\left(0.125, \frac{e^{-1 \cdot \frac{r}{s}}}{s \cdot \pi}, 0.125 \cdot \frac{e^{-0.3333333333333333 \cdot \frac{r}{s}}}{s \cdot \pi}\right)}{r} \]
                        2. Applied rewrites99.5%

                          \[\leadsto \frac{0.125 \cdot \frac{e^{\frac{-r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\pi \cdot s}}{r} \]
                        3. Add Preprocessing

                        Alternative 7: 97.6% accurate, 1.4× speedup?

                        \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                        \[\left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot \frac{0.125}{\left(\pi \cdot r\right) \cdot s} \]
                        (FPCore (s r)
                          :precision binary32
                          :pre (and (and (<= 0.0 s) (<= s 256.0))
                             (and (< 1e-6 r) (< r 1000000.0)))
                          (*
                         (+ (exp (/ r (* -3.0 s))) (exp (/ (- r) s)))
                         (/ 0.125 (* (* PI r) s))))
                        float code(float s, float r) {
                        	return (expf((r / (-3.0f * s))) + expf((-r / s))) * (0.125f / ((((float) M_PI) * r) * s));
                        }
                        
                        function code(s, r)
                        	return Float32(Float32(exp(Float32(r / Float32(Float32(-3.0) * s))) + exp(Float32(Float32(-r) / s))) * Float32(Float32(0.125) / Float32(Float32(Float32(pi) * r) * s)))
                        end
                        
                        function tmp = code(s, r)
                        	tmp = (exp((r / (single(-3.0) * s))) + exp((-r / s))) * (single(0.125) / ((single(pi) * r) * s));
                        end
                        
                        \left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot \frac{0.125}{\left(\pi \cdot r\right) \cdot s}
                        
                        Derivation
                        1. Initial program 99.5%

                          \[\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} \]
                        2. Step-by-step derivation
                          1. Applied rewrites99.5%

                            \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
                          2. Step-by-step derivation
                            1. Applied rewrites99.5%

                              \[\leadsto \frac{0.125}{s} \cdot \frac{\frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{r} \]
                            2. Step-by-step derivation
                              1. Applied rewrites99.5%

                                \[\leadsto \frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi \cdot r} \cdot \frac{0.125}{s} \]
                              2. Step-by-step derivation
                                1. Applied rewrites97.6%

                                  \[\leadsto \left(e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}\right) \cdot \frac{0.125}{\left(\pi \cdot r\right) \cdot s} \]
                                2. Add Preprocessing

                                Alternative 8: 95.2% accurate, 0.6× speedup?

                                \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\left(\pi \cdot s\right) \cdot 4, r, \left(\mathsf{fma}\left(-8 \cdot r, \frac{\pi}{s} \cdot -0.08333333333333333, 2.6666666666666665 \cdot \pi\right) \cdot r\right) \cdot r\right)}\\ \end{array} \]
                                (FPCore (s r)
                                  :precision binary32
                                  :pre (and (and (<= 0.0 s) (<= s 256.0))
                                     (and (< 1e-6 r) (< r 1000000.0)))
                                  (if (<=
                                     (+
                                      (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                      (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                     0.0)
                                  (/ 0.0 (* r (* s PI)))
                                  (/
                                   1.0
                                   (fma
                                    (* (* PI s) 4.0)
                                    r
                                    (*
                                     (*
                                      (fma
                                       (* -8.0 r)
                                       (* (/ PI s) -0.08333333333333333)
                                       (* 2.6666666666666665 PI))
                                      r)
                                     r)))))
                                float code(float s, float r) {
                                	float tmp;
                                	if ((((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))) <= 0.0f) {
                                		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                	} else {
                                		tmp = 1.0f / fmaf(((((float) M_PI) * s) * 4.0f), r, ((fmaf((-8.0f * r), ((((float) M_PI) / s) * -0.08333333333333333f), (2.6666666666666665f * ((float) M_PI))) * r) * r));
                                	}
                                	return tmp;
                                }
                                
                                function code(s, r)
                                	tmp = Float32(0.0)
                                	if (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))) <= Float32(0.0))
                                		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                	else
                                		tmp = Float32(Float32(1.0) / fma(Float32(Float32(Float32(pi) * s) * Float32(4.0)), r, Float32(Float32(fma(Float32(Float32(-8.0) * r), Float32(Float32(Float32(pi) / s) * Float32(-0.08333333333333333)), Float32(Float32(2.6666666666666665) * Float32(pi))) * r) * r)));
                                	end
                                	return tmp
                                end
                                
                                \begin{array}{l}
                                \mathbf{if}\;\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} \leq 0:\\
                                \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\frac{1}{\mathsf{fma}\left(\left(\pi \cdot s\right) \cdot 4, r, \left(\mathsf{fma}\left(-8 \cdot r, \frac{\pi}{s} \cdot -0.08333333333333333, 2.6666666666666665 \cdot \pi\right) \cdot r\right) \cdot r\right)}\\
                                
                                
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                  1. Initial program 99.5%

                                    \[\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} \]
                                  2. Taylor expanded in s around inf

                                    \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites9.4%

                                      \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                    2. Taylor expanded in undef-var around zero

                                      \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites87.8%

                                        \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                      if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                      1. Initial program 99.5%

                                        \[\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} \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites99.5%

                                          \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites99.5%

                                            \[\leadsto \frac{1}{\frac{r}{\frac{0.125 \cdot \frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{s}}} \]
                                          2. Taylor expanded in r around 0

                                            \[\leadsto \frac{1}{r \cdot \left(4 \cdot \left(s \cdot \pi\right) + r \cdot \left(-8 \cdot \left(r \cdot \left(\frac{-2}{9} \cdot \frac{\pi}{s} + \frac{5}{36} \cdot \frac{\pi}{s}\right)\right) + \frac{8}{3} \cdot \pi\right)\right)} \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites27.2%

                                              \[\leadsto \frac{1}{r \cdot \mathsf{fma}\left(4, s \cdot \pi, r \cdot \mathsf{fma}\left(-8, r \cdot \mathsf{fma}\left(-0.2222222222222222, \frac{\pi}{s}, 0.1388888888888889 \cdot \frac{\pi}{s}\right), 2.6666666666666665 \cdot \pi\right)\right)} \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites27.9%

                                                \[\leadsto \frac{1}{\mathsf{fma}\left(\left(\pi \cdot s\right) \cdot 4, r, \left(\mathsf{fma}\left(-8 \cdot r, \frac{\pi}{s} \cdot -0.08333333333333333, 2.6666666666666665 \cdot \pi\right) \cdot r\right) \cdot r\right)} \]
                                            3. Recombined 2 regimes into one program.
                                            4. Add Preprocessing

                                            Alternative 9: 95.2% accurate, 0.6× speedup?

                                            \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                            \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \mathsf{fma}\left(4, s \cdot \pi, r \cdot \mathsf{fma}\left(2.6666666666666665, \pi, \left(-8 \cdot r\right) \cdot \left(\frac{\pi}{s} \cdot -0.08333333333333333\right)\right)\right)}\\ \end{array} \]
                                            (FPCore (s r)
                                              :precision binary32
                                              :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                 (and (< 1e-6 r) (< r 1000000.0)))
                                              (if (<=
                                                 (+
                                                  (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                  (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                 0.0)
                                              (/ 0.0 (* r (* s PI)))
                                              (/
                                               1.0
                                               (*
                                                r
                                                (fma
                                                 4.0
                                                 (* s PI)
                                                 (*
                                                  r
                                                  (fma
                                                   2.6666666666666665
                                                   PI
                                                   (* (* -8.0 r) (* (/ PI s) -0.08333333333333333)))))))))
                                            float code(float s, float r) {
                                            	float tmp;
                                            	if ((((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))) <= 0.0f) {
                                            		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                            	} else {
                                            		tmp = 1.0f / (r * fmaf(4.0f, (s * ((float) M_PI)), (r * fmaf(2.6666666666666665f, ((float) M_PI), ((-8.0f * r) * ((((float) M_PI) / s) * -0.08333333333333333f))))));
                                            	}
                                            	return tmp;
                                            }
                                            
                                            function code(s, r)
                                            	tmp = Float32(0.0)
                                            	if (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))) <= Float32(0.0))
                                            		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                            	else
                                            		tmp = Float32(Float32(1.0) / Float32(r * fma(Float32(4.0), Float32(s * Float32(pi)), Float32(r * fma(Float32(2.6666666666666665), Float32(pi), Float32(Float32(Float32(-8.0) * r) * Float32(Float32(Float32(pi) / s) * Float32(-0.08333333333333333))))))));
                                            	end
                                            	return tmp
                                            end
                                            
                                            \begin{array}{l}
                                            \mathbf{if}\;\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} \leq 0:\\
                                            \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;\frac{1}{r \cdot \mathsf{fma}\left(4, s \cdot \pi, r \cdot \mathsf{fma}\left(2.6666666666666665, \pi, \left(-8 \cdot r\right) \cdot \left(\frac{\pi}{s} \cdot -0.08333333333333333\right)\right)\right)}\\
                                            
                                            
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 2 regimes
                                            2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                              1. Initial program 99.5%

                                                \[\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} \]
                                              2. Taylor expanded in s around inf

                                                \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites9.4%

                                                  \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                2. Taylor expanded in undef-var around zero

                                                  \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites87.8%

                                                    \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                  if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                  1. Initial program 99.5%

                                                    \[\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} \]
                                                  2. Step-by-step derivation
                                                    1. Applied rewrites99.5%

                                                      \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
                                                    2. Step-by-step derivation
                                                      1. Applied rewrites99.5%

                                                        \[\leadsto \frac{1}{\frac{r}{\frac{0.125 \cdot \frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{s}}} \]
                                                      2. Taylor expanded in r around 0

                                                        \[\leadsto \frac{1}{r \cdot \left(4 \cdot \left(s \cdot \pi\right) + r \cdot \left(-8 \cdot \left(r \cdot \left(\frac{-2}{9} \cdot \frac{\pi}{s} + \frac{5}{36} \cdot \frac{\pi}{s}\right)\right) + \frac{8}{3} \cdot \pi\right)\right)} \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites27.2%

                                                          \[\leadsto \frac{1}{r \cdot \mathsf{fma}\left(4, s \cdot \pi, r \cdot \mathsf{fma}\left(-8, r \cdot \mathsf{fma}\left(-0.2222222222222222, \frac{\pi}{s}, 0.1388888888888889 \cdot \frac{\pi}{s}\right), 2.6666666666666665 \cdot \pi\right)\right)} \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites27.8%

                                                            \[\leadsto \frac{1}{r \cdot \mathsf{fma}\left(4, s \cdot \pi, r \cdot \mathsf{fma}\left(2.6666666666666665, \pi, \left(-8 \cdot r\right) \cdot \left(\frac{\pi}{s} \cdot -0.08333333333333333\right)\right)\right)} \]
                                                        3. Recombined 2 regimes into one program.
                                                        4. Add Preprocessing

                                                        Alternative 10: 94.5% accurate, 0.7× speedup?

                                                        \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                        \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.25}{\pi \cdot r} - \frac{\mathsf{fma}\left(r, \frac{-0.06944444444444445}{\pi \cdot s}, 0.053051646798849106\right)}{s}}{s}\\ \end{array} \]
                                                        (FPCore (s r)
                                                          :precision binary32
                                                          :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                             (and (< 1e-6 r) (< r 1000000.0)))
                                                          (if (<=
                                                             (+
                                                              (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                              (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                             0.0)
                                                          (/ 0.0 (* r (* s PI)))
                                                          (/
                                                           (-
                                                            (/ 0.25 (* PI r))
                                                            (/
                                                             (fma r (/ -0.06944444444444445 (* PI s)) 0.053051646798849106)
                                                             s))
                                                           s)))
                                                        float code(float s, float r) {
                                                        	float tmp;
                                                        	if ((((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))) <= 0.0f) {
                                                        		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                        	} else {
                                                        		tmp = ((0.25f / (((float) M_PI) * r)) - (fmaf(r, (-0.06944444444444445f / (((float) M_PI) * s)), 0.053051646798849106f) / s)) / s;
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        function code(s, r)
                                                        	tmp = Float32(0.0)
                                                        	if (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))) <= Float32(0.0))
                                                        		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                        	else
                                                        		tmp = Float32(Float32(Float32(Float32(0.25) / Float32(Float32(pi) * r)) - Float32(fma(r, Float32(Float32(-0.06944444444444445) / Float32(Float32(pi) * s)), Float32(0.053051646798849106)) / s)) / s);
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        \begin{array}{l}
                                                        \mathbf{if}\;\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} \leq 0:\\
                                                        \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\frac{\frac{0.25}{\pi \cdot r} - \frac{\mathsf{fma}\left(r, \frac{-0.06944444444444445}{\pi \cdot s}, 0.053051646798849106\right)}{s}}{s}\\
                                                        
                                                        
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                                          1. Initial program 99.5%

                                                            \[\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} \]
                                                          2. Taylor expanded in s around inf

                                                            \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites9.4%

                                                              \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                            2. Taylor expanded in undef-var around zero

                                                              \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites87.8%

                                                                \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                              if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                              1. Initial program 99.5%

                                                                \[\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} \]
                                                              2. Taylor expanded in s around -inf

                                                                \[\leadsto -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{-1}{16} \cdot \frac{r}{\pi} + \frac{-1}{144} \cdot \frac{r}{\pi}}{s} - \frac{1}{6} \cdot \frac{1}{\pi}}{s} - \frac{1}{4} \cdot \frac{1}{r \cdot \pi}}{s} \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites10.6%

                                                                  \[\leadsto -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\mathsf{fma}\left(-0.0625, \frac{r}{\pi}, -0.006944444444444444 \cdot \frac{r}{\pi}\right)}{s} - 0.16666666666666666 \cdot \frac{1}{\pi}}{s} - 0.25 \cdot \frac{1}{r \cdot \pi}}{s} \]
                                                                2. Applied rewrites10.6%

                                                                  \[\leadsto \frac{\frac{0.25}{\pi \cdot r} - \frac{\frac{0.16666666666666666}{\pi} + \frac{\frac{r}{\pi} \cdot -0.06944444444444445}{s}}{s}}{s} \]
                                                                3. Evaluated real constant10.6%

                                                                  \[\leadsto \frac{\frac{0.25}{\pi \cdot r} - \frac{0.053051646798849106 + \frac{\frac{r}{\pi} \cdot -0.06944444444444445}{s}}{s}}{s} \]
                                                                4. Step-by-step derivation
                                                                  1. Applied rewrites10.6%

                                                                    \[\leadsto \frac{\frac{0.25}{\pi \cdot r} - \frac{\mathsf{fma}\left(r, \frac{-0.06944444444444445}{\pi \cdot s}, 0.053051646798849106\right)}{s}}{s} \]
                                                                5. Recombined 2 regimes into one program.
                                                                6. Add Preprocessing

                                                                Alternative 11: 94.1% accurate, 0.7× speedup?

                                                                \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(r \cdot \mathsf{fma}\left(2.6666666666666665, \frac{r \cdot \pi}{s}, 4 \cdot \pi\right)\right)}\\ \end{array} \]
                                                                (FPCore (s r)
                                                                  :precision binary32
                                                                  :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                     (and (< 1e-6 r) (< r 1000000.0)))
                                                                  (if (<=
                                                                     (+
                                                                      (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                      (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                     0.0)
                                                                  (/ 0.0 (* r (* s PI)))
                                                                  (/
                                                                   1.0
                                                                   (* s (* r (fma 2.6666666666666665 (/ (* r PI) s) (* 4.0 PI)))))))
                                                                float code(float s, float r) {
                                                                	float tmp;
                                                                	if ((((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))) <= 0.0f) {
                                                                		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                	} else {
                                                                		tmp = 1.0f / (s * (r * fmaf(2.6666666666666665f, ((r * ((float) M_PI)) / s), (4.0f * ((float) M_PI)))));
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                function code(s, r)
                                                                	tmp = Float32(0.0)
                                                                	if (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))) <= Float32(0.0))
                                                                		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                	else
                                                                		tmp = Float32(Float32(1.0) / Float32(s * Float32(r * fma(Float32(2.6666666666666665), Float32(Float32(r * Float32(pi)) / s), Float32(Float32(4.0) * Float32(pi))))));
                                                                	end
                                                                	return tmp
                                                                end
                                                                
                                                                \begin{array}{l}
                                                                \mathbf{if}\;\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} \leq 0:\\
                                                                \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                
                                                                \mathbf{else}:\\
                                                                \;\;\;\;\frac{1}{s \cdot \left(r \cdot \mathsf{fma}\left(2.6666666666666665, \frac{r \cdot \pi}{s}, 4 \cdot \pi\right)\right)}\\
                                                                
                                                                
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Split input into 2 regimes
                                                                2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                                                  1. Initial program 99.5%

                                                                    \[\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} \]
                                                                  2. Taylor expanded in s around inf

                                                                    \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites9.4%

                                                                      \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                    2. Taylor expanded in undef-var around zero

                                                                      \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites87.8%

                                                                        \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                      if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                      1. Initial program 99.5%

                                                                        \[\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} \]
                                                                      2. Step-by-step derivation
                                                                        1. Applied rewrites99.5%

                                                                          \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
                                                                        2. Step-by-step derivation
                                                                          1. Applied rewrites99.5%

                                                                            \[\leadsto \frac{1}{\frac{r}{\frac{0.125 \cdot \frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{s}}} \]
                                                                          2. Taylor expanded in s around inf

                                                                            \[\leadsto \frac{1}{s \cdot \left(-2 \cdot \frac{r \cdot \left(\pi \cdot \left(-1 \cdot r + \frac{-1}{3} \cdot r\right)\right)}{s} + 4 \cdot \left(r \cdot \pi\right)\right)} \]
                                                                          3. Step-by-step derivation
                                                                            1. Applied rewrites20.6%

                                                                              \[\leadsto \frac{1}{s \cdot \mathsf{fma}\left(-2, \frac{r \cdot \left(\pi \cdot \mathsf{fma}\left(-1, r, -0.3333333333333333 \cdot r\right)\right)}{s}, 4 \cdot \left(r \cdot \pi\right)\right)} \]
                                                                            2. Taylor expanded in r around 0

                                                                              \[\leadsto \frac{1}{s \cdot \left(r \cdot \left(\frac{8}{3} \cdot \frac{r \cdot \pi}{s} + 4 \cdot \pi\right)\right)} \]
                                                                            3. Step-by-step derivation
                                                                              1. Applied rewrites20.6%

                                                                                \[\leadsto \frac{1}{s \cdot \left(r \cdot \mathsf{fma}\left(2.6666666666666665, \frac{r \cdot \pi}{s}, 4 \cdot \pi\right)\right)} \]
                                                                            4. Recombined 2 regimes into one program.
                                                                            5. Add Preprocessing

                                                                            Alternative 12: 94.1% accurate, 0.7× speedup?

                                                                            \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                            \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \mathsf{fma}\left(2.6666666666666665, r \cdot \pi, 4 \cdot \left(s \cdot \pi\right)\right)}\\ \end{array} \]
                                                                            (FPCore (s r)
                                                                              :precision binary32
                                                                              :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                 (and (< 1e-6 r) (< r 1000000.0)))
                                                                              (if (<=
                                                                                 (+
                                                                                  (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                                  (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                                 0.0)
                                                                              (/ 0.0 (* r (* s PI)))
                                                                              (/ 1.0 (* r (fma 2.6666666666666665 (* r PI) (* 4.0 (* s PI)))))))
                                                                            float code(float s, float r) {
                                                                            	float tmp;
                                                                            	if ((((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))) <= 0.0f) {
                                                                            		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                            	} else {
                                                                            		tmp = 1.0f / (r * fmaf(2.6666666666666665f, (r * ((float) M_PI)), (4.0f * (s * ((float) M_PI)))));
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            function code(s, r)
                                                                            	tmp = Float32(0.0)
                                                                            	if (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))) <= Float32(0.0))
                                                                            		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                            	else
                                                                            		tmp = Float32(Float32(1.0) / Float32(r * fma(Float32(2.6666666666666665), Float32(r * Float32(pi)), Float32(Float32(4.0) * Float32(s * Float32(pi))))));
                                                                            	end
                                                                            	return tmp
                                                                            end
                                                                            
                                                                            \begin{array}{l}
                                                                            \mathbf{if}\;\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} \leq 0:\\
                                                                            \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                            
                                                                            \mathbf{else}:\\
                                                                            \;\;\;\;\frac{1}{r \cdot \mathsf{fma}\left(2.6666666666666665, r \cdot \pi, 4 \cdot \left(s \cdot \pi\right)\right)}\\
                                                                            
                                                                            
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Split input into 2 regimes
                                                                            2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                                                              1. Initial program 99.5%

                                                                                \[\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} \]
                                                                              2. Taylor expanded in s around inf

                                                                                \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites9.4%

                                                                                  \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                2. Taylor expanded in undef-var around zero

                                                                                  \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                3. Step-by-step derivation
                                                                                  1. Applied rewrites87.8%

                                                                                    \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                                  if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                                  1. Initial program 99.5%

                                                                                    \[\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} \]
                                                                                  2. Step-by-step derivation
                                                                                    1. Applied rewrites99.5%

                                                                                      \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
                                                                                    2. Step-by-step derivation
                                                                                      1. Applied rewrites99.5%

                                                                                        \[\leadsto \frac{1}{\frac{r}{\frac{0.125 \cdot \frac{e^{\frac{r}{-3 \cdot s}} + e^{\frac{-r}{s}}}{\pi}}{s}}} \]
                                                                                      2. Taylor expanded in r around 0

                                                                                        \[\leadsto \frac{1}{r \cdot \left(\frac{8}{3} \cdot \left(r \cdot \pi\right) + 4 \cdot \left(s \cdot \pi\right)\right)} \]
                                                                                      3. Step-by-step derivation
                                                                                        1. Applied rewrites12.9%

                                                                                          \[\leadsto \frac{1}{r \cdot \mathsf{fma}\left(2.6666666666666665, r \cdot \pi, 4 \cdot \left(s \cdot \pi\right)\right)} \]
                                                                                      4. Recombined 2 regimes into one program.
                                                                                      5. Add Preprocessing

                                                                                      Alternative 13: 93.4% accurate, 0.8× speedup?

                                                                                      \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                      \[\begin{array}{l} \mathbf{if}\;\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} \leq 1.9999999494757503 \cdot 10^{-5}:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.16666666666666666, \frac{r}{s \cdot \pi}, 0.07957746833562851\right)}{s}}{r}\\ \end{array} \]
                                                                                      (FPCore (s r)
                                                                                        :precision binary32
                                                                                        :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                           (and (< 1e-6 r) (< r 1000000.0)))
                                                                                        (if (<=
                                                                                           (+
                                                                                            (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                                            (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                                           1.9999999494757503e-5)
                                                                                        (/ 0.0 (* r (* s PI)))
                                                                                        (/
                                                                                         (/ (fma -0.16666666666666666 (/ r (* s PI)) 0.07957746833562851) s)
                                                                                         r)))
                                                                                      float code(float s, float r) {
                                                                                      	float tmp;
                                                                                      	if ((((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))) <= 1.9999999494757503e-5f) {
                                                                                      		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                                      	} else {
                                                                                      		tmp = (fmaf(-0.16666666666666666f, (r / (s * ((float) M_PI))), 0.07957746833562851f) / s) / r;
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      function code(s, r)
                                                                                      	tmp = Float32(0.0)
                                                                                      	if (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))) <= Float32(1.9999999494757503e-5))
                                                                                      		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                                      	else
                                                                                      		tmp = Float32(Float32(fma(Float32(-0.16666666666666666), Float32(r / Float32(s * Float32(pi))), Float32(0.07957746833562851)) / s) / r);
                                                                                      	end
                                                                                      	return tmp
                                                                                      end
                                                                                      
                                                                                      \begin{array}{l}
                                                                                      \mathbf{if}\;\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} \leq 1.9999999494757503 \cdot 10^{-5}:\\
                                                                                      \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                                      
                                                                                      \mathbf{else}:\\
                                                                                      \;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.16666666666666666, \frac{r}{s \cdot \pi}, 0.07957746833562851\right)}{s}}{r}\\
                                                                                      
                                                                                      
                                                                                      \end{array}
                                                                                      
                                                                                      Derivation
                                                                                      1. Split input into 2 regimes
                                                                                      2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 1.99999995e-5

                                                                                        1. Initial program 99.5%

                                                                                          \[\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} \]
                                                                                        2. Taylor expanded in s around inf

                                                                                          \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                        3. Step-by-step derivation
                                                                                          1. Applied rewrites9.4%

                                                                                            \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                          2. Taylor expanded in undef-var around zero

                                                                                            \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites87.8%

                                                                                              \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                                            if 1.99999995e-5 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                                            1. Initial program 99.5%

                                                                                              \[\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} \]
                                                                                            2. Taylor expanded in r around 0

                                                                                              \[\leadsto \frac{\frac{-1}{6} \cdot \frac{r}{{s}^{2} \cdot \pi} + \frac{1}{4} \cdot \frac{1}{s \cdot \pi}}{r} \]
                                                                                            3. Step-by-step derivation
                                                                                              1. Applied rewrites9.6%

                                                                                                \[\leadsto \frac{\mathsf{fma}\left(-0.16666666666666666, \frac{r}{{s}^{2} \cdot \pi}, 0.25 \cdot \frac{1}{s \cdot \pi}\right)}{r} \]
                                                                                              2. Taylor expanded in s around inf

                                                                                                \[\leadsto \frac{\frac{\frac{-1}{6} \cdot \frac{r}{s \cdot \pi} + \frac{1}{4} \cdot \frac{1}{\pi}}{s}}{r} \]
                                                                                              3. Step-by-step derivation
                                                                                                1. Applied rewrites9.6%

                                                                                                  \[\leadsto \frac{\frac{\mathsf{fma}\left(-0.16666666666666666, \frac{r}{s \cdot \pi}, 0.25 \cdot \frac{1}{\pi}\right)}{s}}{r} \]
                                                                                                2. Evaluated real constant9.6%

                                                                                                  \[\leadsto \frac{\frac{\mathsf{fma}\left(-0.16666666666666666, \frac{r}{s \cdot \pi}, 0.07957746833562851\right)}{s}}{r} \]
                                                                                              4. Recombined 2 regimes into one program.
                                                                                              5. Add Preprocessing

                                                                                              Alternative 14: 93.4% accurate, 0.8× speedup?

                                                                                              \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                              \[\begin{array}{l} \mathbf{if}\;\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} \leq 1.9999999494757503 \cdot 10^{-5}:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.25}{\pi \cdot r} - \frac{0.053051646798849106}{s}}{s}\\ \end{array} \]
                                                                                              (FPCore (s r)
                                                                                                :precision binary32
                                                                                                :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                   (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                (if (<=
                                                                                                   (+
                                                                                                    (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                                                    (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                                                   1.9999999494757503e-5)
                                                                                                (/ 0.0 (* r (* s PI)))
                                                                                                (/ (- (/ 0.25 (* PI r)) (/ 0.053051646798849106 s)) s)))
                                                                                              float code(float s, float r) {
                                                                                              	float tmp;
                                                                                              	if ((((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))) <= 1.9999999494757503e-5f) {
                                                                                              		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                                              	} else {
                                                                                              		tmp = ((0.25f / (((float) M_PI) * r)) - (0.053051646798849106f / s)) / s;
                                                                                              	}
                                                                                              	return tmp;
                                                                                              }
                                                                                              
                                                                                              function code(s, r)
                                                                                              	tmp = Float32(0.0)
                                                                                              	if (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))) <= Float32(1.9999999494757503e-5))
                                                                                              		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                                              	else
                                                                                              		tmp = Float32(Float32(Float32(Float32(0.25) / Float32(Float32(pi) * r)) - Float32(Float32(0.053051646798849106) / s)) / s);
                                                                                              	end
                                                                                              	return tmp
                                                                                              end
                                                                                              
                                                                                              function tmp_2 = code(s, r)
                                                                                              	tmp = single(0.0);
                                                                                              	if ((((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))) <= single(1.9999999494757503e-5))
                                                                                              		tmp = single(0.0) / (r * (s * single(pi)));
                                                                                              	else
                                                                                              		tmp = ((single(0.25) / (single(pi) * r)) - (single(0.053051646798849106) / s)) / s;
                                                                                              	end
                                                                                              	tmp_2 = tmp;
                                                                                              end
                                                                                              
                                                                                              \begin{array}{l}
                                                                                              \mathbf{if}\;\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} \leq 1.9999999494757503 \cdot 10^{-5}:\\
                                                                                              \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                                              
                                                                                              \mathbf{else}:\\
                                                                                              \;\;\;\;\frac{\frac{0.25}{\pi \cdot r} - \frac{0.053051646798849106}{s}}{s}\\
                                                                                              
                                                                                              
                                                                                              \end{array}
                                                                                              
                                                                                              Derivation
                                                                                              1. Split input into 2 regimes
                                                                                              2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 1.99999995e-5

                                                                                                1. Initial program 99.5%

                                                                                                  \[\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} \]
                                                                                                2. Taylor expanded in s around inf

                                                                                                  \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                3. Step-by-step derivation
                                                                                                  1. Applied rewrites9.4%

                                                                                                    \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                  2. Taylor expanded in undef-var around zero

                                                                                                    \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                  3. Step-by-step derivation
                                                                                                    1. Applied rewrites87.8%

                                                                                                      \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                                                    if 1.99999995e-5 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                                                    1. Initial program 99.5%

                                                                                                      \[\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} \]
                                                                                                    2. Taylor expanded in s around -inf

                                                                                                      \[\leadsto -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{-1}{16} \cdot \frac{r}{\pi} + \frac{-1}{144} \cdot \frac{r}{\pi}}{s} - \frac{1}{6} \cdot \frac{1}{\pi}}{s} - \frac{1}{4} \cdot \frac{1}{r \cdot \pi}}{s} \]
                                                                                                    3. Step-by-step derivation
                                                                                                      1. Applied rewrites10.6%

                                                                                                        \[\leadsto -1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\mathsf{fma}\left(-0.0625, \frac{r}{\pi}, -0.006944444444444444 \cdot \frac{r}{\pi}\right)}{s} - 0.16666666666666666 \cdot \frac{1}{\pi}}{s} - 0.25 \cdot \frac{1}{r \cdot \pi}}{s} \]
                                                                                                      2. Applied rewrites10.6%

                                                                                                        \[\leadsto \frac{\frac{0.25}{\pi \cdot r} - \frac{\frac{0.16666666666666666}{\pi} + \frac{\frac{r}{\pi} \cdot -0.06944444444444445}{s}}{s}}{s} \]
                                                                                                      3. Evaluated real constant10.6%

                                                                                                        \[\leadsto \frac{\frac{0.25}{\pi \cdot r} - \frac{0.053051646798849106 + \frac{\frac{r}{\pi} \cdot -0.06944444444444445}{s}}{s}}{s} \]
                                                                                                      4. Taylor expanded in s around inf

                                                                                                        \[\leadsto \frac{\frac{0.25}{\pi \cdot r} - \frac{\frac{14240943}{268435456}}{s}}{s} \]
                                                                                                      5. Step-by-step derivation
                                                                                                        1. Applied rewrites9.6%

                                                                                                          \[\leadsto \frac{\frac{0.25}{\pi \cdot r} - \frac{0.053051646798849106}{s}}{s} \]
                                                                                                      6. Recombined 2 regimes into one program.
                                                                                                      7. Add Preprocessing

                                                                                                      Alternative 15: 93.3% accurate, 0.8× speedup?

                                                                                                      \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                                      \[\begin{array}{l} \mathbf{if}\;\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} \leq 1.9999999494757503 \cdot 10^{-5}:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.07957746833562851}{r} + \frac{-0.16666666666666666}{\pi \cdot s}}{s}\\ \end{array} \]
                                                                                                      (FPCore (s r)
                                                                                                        :precision binary32
                                                                                                        :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                           (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                        (if (<=
                                                                                                           (+
                                                                                                            (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                                                            (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                                                           1.9999999494757503e-5)
                                                                                                        (/ 0.0 (* r (* s PI)))
                                                                                                        (/
                                                                                                         (+ (/ 0.07957746833562851 r) (/ -0.16666666666666666 (* PI s)))
                                                                                                         s)))
                                                                                                      float code(float s, float r) {
                                                                                                      	float tmp;
                                                                                                      	if ((((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))) <= 1.9999999494757503e-5f) {
                                                                                                      		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                                                      	} else {
                                                                                                      		tmp = ((0.07957746833562851f / r) + (-0.16666666666666666f / (((float) M_PI) * s))) / s;
                                                                                                      	}
                                                                                                      	return tmp;
                                                                                                      }
                                                                                                      
                                                                                                      function code(s, r)
                                                                                                      	tmp = Float32(0.0)
                                                                                                      	if (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))) <= Float32(1.9999999494757503e-5))
                                                                                                      		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                                                      	else
                                                                                                      		tmp = Float32(Float32(Float32(Float32(0.07957746833562851) / r) + Float32(Float32(-0.16666666666666666) / Float32(Float32(pi) * s))) / s);
                                                                                                      	end
                                                                                                      	return tmp
                                                                                                      end
                                                                                                      
                                                                                                      function tmp_2 = code(s, r)
                                                                                                      	tmp = single(0.0);
                                                                                                      	if ((((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))) <= single(1.9999999494757503e-5))
                                                                                                      		tmp = single(0.0) / (r * (s * single(pi)));
                                                                                                      	else
                                                                                                      		tmp = ((single(0.07957746833562851) / r) + (single(-0.16666666666666666) / (single(pi) * s))) / s;
                                                                                                      	end
                                                                                                      	tmp_2 = tmp;
                                                                                                      end
                                                                                                      
                                                                                                      \begin{array}{l}
                                                                                                      \mathbf{if}\;\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} \leq 1.9999999494757503 \cdot 10^{-5}:\\
                                                                                                      \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                                                      
                                                                                                      \mathbf{else}:\\
                                                                                                      \;\;\;\;\frac{\frac{0.07957746833562851}{r} + \frac{-0.16666666666666666}{\pi \cdot s}}{s}\\
                                                                                                      
                                                                                                      
                                                                                                      \end{array}
                                                                                                      
                                                                                                      Derivation
                                                                                                      1. Split input into 2 regimes
                                                                                                      2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 1.99999995e-5

                                                                                                        1. Initial program 99.5%

                                                                                                          \[\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} \]
                                                                                                        2. Taylor expanded in s around inf

                                                                                                          \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                        3. Step-by-step derivation
                                                                                                          1. Applied rewrites9.4%

                                                                                                            \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                          2. Taylor expanded in undef-var around zero

                                                                                                            \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                          3. Step-by-step derivation
                                                                                                            1. Applied rewrites87.8%

                                                                                                              \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                                                            if 1.99999995e-5 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                                                            1. Initial program 99.5%

                                                                                                              \[\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} \]
                                                                                                            2. Taylor expanded in s around inf

                                                                                                              \[\leadsto \frac{\frac{1}{4} \cdot \frac{1}{r \cdot \pi} - \frac{1}{6} \cdot \frac{1}{s \cdot \pi}}{s} \]
                                                                                                            3. Step-by-step derivation
                                                                                                              1. Applied rewrites9.6%

                                                                                                                \[\leadsto \frac{0.25 \cdot \frac{1}{r \cdot \pi} - 0.16666666666666666 \cdot \frac{1}{s \cdot \pi}}{s} \]
                                                                                                              2. Step-by-step derivation
                                                                                                                1. Applied rewrites9.6%

                                                                                                                  \[\leadsto \frac{\mathsf{fma}\left(\frac{0.25}{\pi}, \frac{1}{r}, \frac{-0.16666666666666666}{\pi \cdot s}\right)}{s} \]
                                                                                                                2. Evaluated real constant9.6%

                                                                                                                  \[\leadsto \frac{\mathsf{fma}\left(0.07957746833562851, \frac{1}{r}, \frac{-0.16666666666666666}{\pi \cdot s}\right)}{s} \]
                                                                                                                3. Applied rewrites9.6%

                                                                                                                  \[\leadsto \frac{\frac{0.07957746833562851}{r} + \frac{-0.16666666666666666}{\pi \cdot s}}{s} \]
                                                                                                              3. Recombined 2 regimes into one program.
                                                                                                              4. Add Preprocessing

                                                                                                              Alternative 16: 92.4% accurate, 0.8× speedup?

                                                                                                              \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                                              \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{r} \cdot \frac{1}{\pi \cdot s}\\ \end{array} \]
                                                                                                              (FPCore (s r)
                                                                                                                :precision binary32
                                                                                                                :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                                   (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                                (if (<=
                                                                                                                   (+
                                                                                                                    (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                                                                    (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                                                                   0.0)
                                                                                                                (/ 0.0 (* r (* s PI)))
                                                                                                                (* (/ 0.25 r) (/ 1.0 (* PI s)))))
                                                                                                              float code(float s, float r) {
                                                                                                              	float tmp;
                                                                                                              	if ((((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))) <= 0.0f) {
                                                                                                              		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                                                              	} else {
                                                                                                              		tmp = (0.25f / r) * (1.0f / (((float) M_PI) * s));
                                                                                                              	}
                                                                                                              	return tmp;
                                                                                                              }
                                                                                                              
                                                                                                              function code(s, r)
                                                                                                              	tmp = Float32(0.0)
                                                                                                              	if (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))) <= Float32(0.0))
                                                                                                              		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                                                              	else
                                                                                                              		tmp = Float32(Float32(Float32(0.25) / r) * Float32(Float32(1.0) / Float32(Float32(pi) * s)));
                                                                                                              	end
                                                                                                              	return tmp
                                                                                                              end
                                                                                                              
                                                                                                              function tmp_2 = code(s, r)
                                                                                                              	tmp = single(0.0);
                                                                                                              	if ((((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))) <= single(0.0))
                                                                                                              		tmp = single(0.0) / (r * (s * single(pi)));
                                                                                                              	else
                                                                                                              		tmp = (single(0.25) / r) * (single(1.0) / (single(pi) * s));
                                                                                                              	end
                                                                                                              	tmp_2 = tmp;
                                                                                                              end
                                                                                                              
                                                                                                              \begin{array}{l}
                                                                                                              \mathbf{if}\;\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} \leq 0:\\
                                                                                                              \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                                                              
                                                                                                              \mathbf{else}:\\
                                                                                                              \;\;\;\;\frac{0.25}{r} \cdot \frac{1}{\pi \cdot s}\\
                                                                                                              
                                                                                                              
                                                                                                              \end{array}
                                                                                                              
                                                                                                              Derivation
                                                                                                              1. Split input into 2 regimes
                                                                                                              2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                                                                                                1. Initial program 99.5%

                                                                                                                  \[\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} \]
                                                                                                                2. Taylor expanded in s around inf

                                                                                                                  \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                3. Step-by-step derivation
                                                                                                                  1. Applied rewrites9.4%

                                                                                                                    \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                  2. Taylor expanded in undef-var around zero

                                                                                                                    \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                  3. Step-by-step derivation
                                                                                                                    1. Applied rewrites87.8%

                                                                                                                      \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                                                                    if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                                                                    1. Initial program 99.5%

                                                                                                                      \[\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} \]
                                                                                                                    2. Taylor expanded in s around inf

                                                                                                                      \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                    3. Step-by-step derivation
                                                                                                                      1. Applied rewrites9.4%

                                                                                                                        \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                      2. Step-by-step derivation
                                                                                                                        1. Applied rewrites9.4%

                                                                                                                          \[\leadsto \frac{0.25}{r} \cdot \frac{1}{\pi \cdot s} \]
                                                                                                                      3. Recombined 2 regimes into one program.
                                                                                                                      4. Add Preprocessing

                                                                                                                      Alternative 17: 92.4% accurate, 0.8× speedup?

                                                                                                                      \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                                                      \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.25}{s \cdot \pi}}{-r}\\ \end{array} \]
                                                                                                                      (FPCore (s r)
                                                                                                                        :precision binary32
                                                                                                                        :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                                           (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                                        (if (<=
                                                                                                                           (+
                                                                                                                            (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                                                                            (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                                                                           0.0)
                                                                                                                        (/ 0.0 (* r (* s PI)))
                                                                                                                        (/ (/ -0.25 (* s PI)) (- r))))
                                                                                                                      float code(float s, float r) {
                                                                                                                      	float tmp;
                                                                                                                      	if ((((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))) <= 0.0f) {
                                                                                                                      		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                                                                      	} else {
                                                                                                                      		tmp = (-0.25f / (s * ((float) M_PI))) / -r;
                                                                                                                      	}
                                                                                                                      	return tmp;
                                                                                                                      }
                                                                                                                      
                                                                                                                      function code(s, r)
                                                                                                                      	tmp = Float32(0.0)
                                                                                                                      	if (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))) <= Float32(0.0))
                                                                                                                      		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                                                                      	else
                                                                                                                      		tmp = Float32(Float32(Float32(-0.25) / Float32(s * Float32(pi))) / Float32(-r));
                                                                                                                      	end
                                                                                                                      	return tmp
                                                                                                                      end
                                                                                                                      
                                                                                                                      function tmp_2 = code(s, r)
                                                                                                                      	tmp = single(0.0);
                                                                                                                      	if ((((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))) <= single(0.0))
                                                                                                                      		tmp = single(0.0) / (r * (s * single(pi)));
                                                                                                                      	else
                                                                                                                      		tmp = (single(-0.25) / (s * single(pi))) / -r;
                                                                                                                      	end
                                                                                                                      	tmp_2 = tmp;
                                                                                                                      end
                                                                                                                      
                                                                                                                      \begin{array}{l}
                                                                                                                      \mathbf{if}\;\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} \leq 0:\\
                                                                                                                      \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                                                                      
                                                                                                                      \mathbf{else}:\\
                                                                                                                      \;\;\;\;\frac{\frac{-0.25}{s \cdot \pi}}{-r}\\
                                                                                                                      
                                                                                                                      
                                                                                                                      \end{array}
                                                                                                                      
                                                                                                                      Derivation
                                                                                                                      1. Split input into 2 regimes
                                                                                                                      2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                                                                                                        1. Initial program 99.5%

                                                                                                                          \[\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} \]
                                                                                                                        2. Taylor expanded in s around inf

                                                                                                                          \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                        3. Step-by-step derivation
                                                                                                                          1. Applied rewrites9.4%

                                                                                                                            \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                          2. Taylor expanded in undef-var around zero

                                                                                                                            \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                          3. Step-by-step derivation
                                                                                                                            1. Applied rewrites87.8%

                                                                                                                              \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                                                                            if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                                                                            1. Initial program 99.5%

                                                                                                                              \[\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} \]
                                                                                                                            2. Applied rewrites99.4%

                                                                                                                              \[\leadsto \frac{\left(-\frac{0.125}{e^{\frac{r}{3 \cdot s}} \cdot \left(\pi \cdot s\right)}\right) + \left(-\frac{0.125}{e^{\frac{r}{s}} \cdot \left(\pi \cdot s\right)}\right)}{-r} \]
                                                                                                                            3. Taylor expanded in s around inf

                                                                                                                              \[\leadsto \frac{\frac{\frac{-1}{4}}{s \cdot \pi}}{-r} \]
                                                                                                                            4. Step-by-step derivation
                                                                                                                              1. Applied rewrites9.4%

                                                                                                                                \[\leadsto \frac{\frac{-0.25}{s \cdot \pi}}{-r} \]
                                                                                                                            5. Recombined 2 regimes into one program.
                                                                                                                            6. Add Preprocessing

                                                                                                                            Alternative 18: 92.4% accurate, 0.8× speedup?

                                                                                                                            \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                                                            \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{\left(s \cdot r\right) \cdot \pi}\\ \end{array} \]
                                                                                                                            (FPCore (s r)
                                                                                                                              :precision binary32
                                                                                                                              :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                                                 (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                                              (if (<=
                                                                                                                                 (+
                                                                                                                                  (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                                                                                  (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                                                                                 0.0)
                                                                                                                              (/ 0.0 (* r (* s PI)))
                                                                                                                              (/ 0.25 (* (* s r) PI))))
                                                                                                                            float code(float s, float r) {
                                                                                                                            	float tmp;
                                                                                                                            	if ((((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))) <= 0.0f) {
                                                                                                                            		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                                                                            	} else {
                                                                                                                            		tmp = 0.25f / ((s * r) * ((float) M_PI));
                                                                                                                            	}
                                                                                                                            	return tmp;
                                                                                                                            }
                                                                                                                            
                                                                                                                            function code(s, r)
                                                                                                                            	tmp = Float32(0.0)
                                                                                                                            	if (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))) <= Float32(0.0))
                                                                                                                            		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                                                                            	else
                                                                                                                            		tmp = Float32(Float32(0.25) / Float32(Float32(s * r) * Float32(pi)));
                                                                                                                            	end
                                                                                                                            	return tmp
                                                                                                                            end
                                                                                                                            
                                                                                                                            function tmp_2 = code(s, r)
                                                                                                                            	tmp = single(0.0);
                                                                                                                            	if ((((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))) <= single(0.0))
                                                                                                                            		tmp = single(0.0) / (r * (s * single(pi)));
                                                                                                                            	else
                                                                                                                            		tmp = single(0.25) / ((s * r) * single(pi));
                                                                                                                            	end
                                                                                                                            	tmp_2 = tmp;
                                                                                                                            end
                                                                                                                            
                                                                                                                            \begin{array}{l}
                                                                                                                            \mathbf{if}\;\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} \leq 0:\\
                                                                                                                            \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                                                                            
                                                                                                                            \mathbf{else}:\\
                                                                                                                            \;\;\;\;\frac{0.25}{\left(s \cdot r\right) \cdot \pi}\\
                                                                                                                            
                                                                                                                            
                                                                                                                            \end{array}
                                                                                                                            
                                                                                                                            Derivation
                                                                                                                            1. Split input into 2 regimes
                                                                                                                            2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                                                                                                              1. Initial program 99.5%

                                                                                                                                \[\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} \]
                                                                                                                              2. Taylor expanded in s around inf

                                                                                                                                \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                              3. Step-by-step derivation
                                                                                                                                1. Applied rewrites9.4%

                                                                                                                                  \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                                2. Taylor expanded in undef-var around zero

                                                                                                                                  \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                                3. Step-by-step derivation
                                                                                                                                  1. Applied rewrites87.8%

                                                                                                                                    \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                                                                                  if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                                                                                  1. Initial program 99.5%

                                                                                                                                    \[\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} \]
                                                                                                                                  2. Taylor expanded in s around inf

                                                                                                                                    \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                                  3. Step-by-step derivation
                                                                                                                                    1. Applied rewrites9.4%

                                                                                                                                      \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                                    2. Applied rewrites9.4%

                                                                                                                                      \[\leadsto \frac{0.25}{\left(s \cdot r\right) \cdot \pi} \]
                                                                                                                                  4. Recombined 2 regimes into one program.
                                                                                                                                  5. Add Preprocessing

                                                                                                                                  Alternative 19: 92.4% accurate, 0.8× speedup?

                                                                                                                                  \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                                                                  \[\begin{array}{l} \mathbf{if}\;\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} \leq 0:\\ \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.07957746833562851}{r}}{s}\\ \end{array} \]
                                                                                                                                  (FPCore (s r)
                                                                                                                                    :precision binary32
                                                                                                                                    :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                                                       (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                                                    (if (<=
                                                                                                                                       (+
                                                                                                                                        (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r))
                                                                                                                                        (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r)))
                                                                                                                                       0.0)
                                                                                                                                    (/ 0.0 (* r (* s PI)))
                                                                                                                                    (/ (/ 0.07957746833562851 r) s)))
                                                                                                                                  float code(float s, float r) {
                                                                                                                                  	float tmp;
                                                                                                                                  	if ((((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))) <= 0.0f) {
                                                                                                                                  		tmp = 0.0f / (r * (s * ((float) M_PI)));
                                                                                                                                  	} else {
                                                                                                                                  		tmp = (0.07957746833562851f / r) / s;
                                                                                                                                  	}
                                                                                                                                  	return tmp;
                                                                                                                                  }
                                                                                                                                  
                                                                                                                                  function code(s, r)
                                                                                                                                  	tmp = Float32(0.0)
                                                                                                                                  	if (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))) <= Float32(0.0))
                                                                                                                                  		tmp = Float32(Float32(0.0) / Float32(r * Float32(s * Float32(pi))));
                                                                                                                                  	else
                                                                                                                                  		tmp = Float32(Float32(Float32(0.07957746833562851) / r) / s);
                                                                                                                                  	end
                                                                                                                                  	return tmp
                                                                                                                                  end
                                                                                                                                  
                                                                                                                                  function tmp_2 = code(s, r)
                                                                                                                                  	tmp = single(0.0);
                                                                                                                                  	if ((((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))) <= single(0.0))
                                                                                                                                  		tmp = single(0.0) / (r * (s * single(pi)));
                                                                                                                                  	else
                                                                                                                                  		tmp = (single(0.07957746833562851) / r) / s;
                                                                                                                                  	end
                                                                                                                                  	tmp_2 = tmp;
                                                                                                                                  end
                                                                                                                                  
                                                                                                                                  \begin{array}{l}
                                                                                                                                  \mathbf{if}\;\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} \leq 0:\\
                                                                                                                                  \;\;\;\;\frac{0}{r \cdot \left(s \cdot \pi\right)}\\
                                                                                                                                  
                                                                                                                                  \mathbf{else}:\\
                                                                                                                                  \;\;\;\;\frac{\frac{0.07957746833562851}{r}}{s}\\
                                                                                                                                  
                                                                                                                                  
                                                                                                                                  \end{array}
                                                                                                                                  
                                                                                                                                  Derivation
                                                                                                                                  1. Split input into 2 regimes
                                                                                                                                  2. if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0

                                                                                                                                    1. Initial program 99.5%

                                                                                                                                      \[\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} \]
                                                                                                                                    2. Taylor expanded in s around inf

                                                                                                                                      \[\leadsto \frac{\frac{1}{4}}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                                    3. Step-by-step derivation
                                                                                                                                      1. Applied rewrites9.4%

                                                                                                                                        \[\leadsto \frac{0.25}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                                      2. Taylor expanded in undef-var around zero

                                                                                                                                        \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]
                                                                                                                                      3. Step-by-step derivation
                                                                                                                                        1. Applied rewrites87.8%

                                                                                                                                          \[\leadsto \frac{0}{r \cdot \left(s \cdot \pi\right)} \]

                                                                                                                                        if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r)))

                                                                                                                                        1. Initial program 99.5%

                                                                                                                                          \[\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} \]
                                                                                                                                        2. Taylor expanded in s around inf

                                                                                                                                          \[\leadsto \frac{\frac{1}{4} \cdot \frac{1}{r \cdot \pi} - \frac{1}{6} \cdot \frac{1}{s \cdot \pi}}{s} \]
                                                                                                                                        3. Step-by-step derivation
                                                                                                                                          1. Applied rewrites9.6%

                                                                                                                                            \[\leadsto \frac{0.25 \cdot \frac{1}{r \cdot \pi} - 0.16666666666666666 \cdot \frac{1}{s \cdot \pi}}{s} \]
                                                                                                                                          2. Step-by-step derivation
                                                                                                                                            1. Applied rewrites9.6%

                                                                                                                                              \[\leadsto \frac{\mathsf{fma}\left(\frac{0.25}{\pi}, \frac{1}{r}, \frac{-0.16666666666666666}{\pi \cdot s}\right)}{s} \]
                                                                                                                                            2. Evaluated real constant9.6%

                                                                                                                                              \[\leadsto \frac{\mathsf{fma}\left(0.07957746833562851, \frac{1}{r}, \frac{-0.16666666666666666}{\pi \cdot s}\right)}{s} \]
                                                                                                                                            3. Taylor expanded in s around inf

                                                                                                                                              \[\leadsto \frac{\frac{\frac{10680707}{134217728}}{r}}{s} \]
                                                                                                                                            4. Step-by-step derivation
                                                                                                                                              1. Applied rewrites9.4%

                                                                                                                                                \[\leadsto \frac{\frac{0.07957746833562851}{r}}{s} \]
                                                                                                                                            5. Recombined 2 regimes into one program.
                                                                                                                                            6. Add Preprocessing

                                                                                                                                            Alternative 20: 9.4% accurate, 8.1× speedup?

                                                                                                                                            \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                                                                            \[\frac{\frac{0.07957746833562851}{r}}{s} \]
                                                                                                                                            (FPCore (s r)
                                                                                                                                              :precision binary32
                                                                                                                                              :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                                                                 (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                                                              (/ (/ 0.07957746833562851 r) s))
                                                                                                                                            float code(float s, float r) {
                                                                                                                                            	return (0.07957746833562851f / r) / s;
                                                                                                                                            }
                                                                                                                                            
                                                                                                                                            real(4) function code(s, r)
                                                                                                                                            use fmin_fmax_functions
                                                                                                                                                real(4), intent (in) :: s
                                                                                                                                                real(4), intent (in) :: r
                                                                                                                                                code = (0.07957746833562851e0 / r) / s
                                                                                                                                            end function
                                                                                                                                            
                                                                                                                                            function code(s, r)
                                                                                                                                            	return Float32(Float32(Float32(0.07957746833562851) / r) / s)
                                                                                                                                            end
                                                                                                                                            
                                                                                                                                            function tmp = code(s, r)
                                                                                                                                            	tmp = (single(0.07957746833562851) / r) / s;
                                                                                                                                            end
                                                                                                                                            
                                                                                                                                            \frac{\frac{0.07957746833562851}{r}}{s}
                                                                                                                                            
                                                                                                                                            Derivation
                                                                                                                                            1. Initial program 99.5%

                                                                                                                                              \[\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} \]
                                                                                                                                            2. Taylor expanded in s around inf

                                                                                                                                              \[\leadsto \frac{\frac{1}{4} \cdot \frac{1}{r \cdot \pi} - \frac{1}{6} \cdot \frac{1}{s \cdot \pi}}{s} \]
                                                                                                                                            3. Step-by-step derivation
                                                                                                                                              1. Applied rewrites9.6%

                                                                                                                                                \[\leadsto \frac{0.25 \cdot \frac{1}{r \cdot \pi} - 0.16666666666666666 \cdot \frac{1}{s \cdot \pi}}{s} \]
                                                                                                                                              2. Step-by-step derivation
                                                                                                                                                1. Applied rewrites9.6%

                                                                                                                                                  \[\leadsto \frac{\mathsf{fma}\left(\frac{0.25}{\pi}, \frac{1}{r}, \frac{-0.16666666666666666}{\pi \cdot s}\right)}{s} \]
                                                                                                                                                2. Evaluated real constant9.6%

                                                                                                                                                  \[\leadsto \frac{\mathsf{fma}\left(0.07957746833562851, \frac{1}{r}, \frac{-0.16666666666666666}{\pi \cdot s}\right)}{s} \]
                                                                                                                                                3. Taylor expanded in s around inf

                                                                                                                                                  \[\leadsto \frac{\frac{\frac{10680707}{134217728}}{r}}{s} \]
                                                                                                                                                4. Step-by-step derivation
                                                                                                                                                  1. Applied rewrites9.4%

                                                                                                                                                    \[\leadsto \frac{\frac{0.07957746833562851}{r}}{s} \]
                                                                                                                                                  2. Add Preprocessing

                                                                                                                                                  Alternative 21: 9.4% accurate, 8.1× speedup?

                                                                                                                                                  \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                                                                                  \[\frac{\frac{0.07957746833562851}{s}}{r} \]
                                                                                                                                                  (FPCore (s r)
                                                                                                                                                    :precision binary32
                                                                                                                                                    :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                                                                       (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                                                                    (/ (/ 0.07957746833562851 s) r))
                                                                                                                                                  float code(float s, float r) {
                                                                                                                                                  	return (0.07957746833562851f / s) / r;
                                                                                                                                                  }
                                                                                                                                                  
                                                                                                                                                  real(4) function code(s, r)
                                                                                                                                                  use fmin_fmax_functions
                                                                                                                                                      real(4), intent (in) :: s
                                                                                                                                                      real(4), intent (in) :: r
                                                                                                                                                      code = (0.07957746833562851e0 / s) / r
                                                                                                                                                  end function
                                                                                                                                                  
                                                                                                                                                  function code(s, r)
                                                                                                                                                  	return Float32(Float32(Float32(0.07957746833562851) / s) / r)
                                                                                                                                                  end
                                                                                                                                                  
                                                                                                                                                  function tmp = code(s, r)
                                                                                                                                                  	tmp = (single(0.07957746833562851) / s) / r;
                                                                                                                                                  end
                                                                                                                                                  
                                                                                                                                                  \frac{\frac{0.07957746833562851}{s}}{r}
                                                                                                                                                  
                                                                                                                                                  Derivation
                                                                                                                                                  1. Initial program 99.5%

                                                                                                                                                    \[\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} \]
                                                                                                                                                  2. Taylor expanded in r around 0

                                                                                                                                                    \[\leadsto \frac{\frac{-1}{6} \cdot \frac{r}{{s}^{2} \cdot \pi} + \frac{1}{4} \cdot \frac{1}{s \cdot \pi}}{r} \]
                                                                                                                                                  3. Step-by-step derivation
                                                                                                                                                    1. Applied rewrites9.6%

                                                                                                                                                      \[\leadsto \frac{\mathsf{fma}\left(-0.16666666666666666, \frac{r}{{s}^{2} \cdot \pi}, 0.25 \cdot \frac{1}{s \cdot \pi}\right)}{r} \]
                                                                                                                                                    2. Taylor expanded in s around inf

                                                                                                                                                      \[\leadsto \frac{\frac{\frac{-1}{6} \cdot \frac{r}{s \cdot \pi} + \frac{1}{4} \cdot \frac{1}{\pi}}{s}}{r} \]
                                                                                                                                                    3. Step-by-step derivation
                                                                                                                                                      1. Applied rewrites9.6%

                                                                                                                                                        \[\leadsto \frac{\frac{\mathsf{fma}\left(-0.16666666666666666, \frac{r}{s \cdot \pi}, 0.25 \cdot \frac{1}{\pi}\right)}{s}}{r} \]
                                                                                                                                                      2. Taylor expanded in s around inf

                                                                                                                                                        \[\leadsto \frac{\frac{\frac{\frac{1}{4}}{\pi}}{s}}{r} \]
                                                                                                                                                      3. Step-by-step derivation
                                                                                                                                                        1. Applied rewrites9.4%

                                                                                                                                                          \[\leadsto \frac{\frac{\frac{0.25}{\pi}}{s}}{r} \]
                                                                                                                                                        2. Evaluated real constant9.4%

                                                                                                                                                          \[\leadsto \frac{\frac{0.07957746833562851}{s}}{r} \]
                                                                                                                                                        3. Add Preprocessing

                                                                                                                                                        Alternative 22: 9.4% accurate, 8.9× speedup?

                                                                                                                                                        \[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
                                                                                                                                                        \[\frac{0.07957746833562851}{s \cdot r} \]
                                                                                                                                                        (FPCore (s r)
                                                                                                                                                          :precision binary32
                                                                                                                                                          :pre (and (and (<= 0.0 s) (<= s 256.0))
                                                                                                                                                             (and (< 1e-6 r) (< r 1000000.0)))
                                                                                                                                                          (/ 0.07957746833562851 (* s r)))
                                                                                                                                                        float code(float s, float r) {
                                                                                                                                                        	return 0.07957746833562851f / (s * r);
                                                                                                                                                        }
                                                                                                                                                        
                                                                                                                                                        real(4) function code(s, r)
                                                                                                                                                        use fmin_fmax_functions
                                                                                                                                                            real(4), intent (in) :: s
                                                                                                                                                            real(4), intent (in) :: r
                                                                                                                                                            code = 0.07957746833562851e0 / (s * r)
                                                                                                                                                        end function
                                                                                                                                                        
                                                                                                                                                        function code(s, r)
                                                                                                                                                        	return Float32(Float32(0.07957746833562851) / Float32(s * r))
                                                                                                                                                        end
                                                                                                                                                        
                                                                                                                                                        function tmp = code(s, r)
                                                                                                                                                        	tmp = single(0.07957746833562851) / (s * r);
                                                                                                                                                        end
                                                                                                                                                        
                                                                                                                                                        \frac{0.07957746833562851}{s \cdot r}
                                                                                                                                                        
                                                                                                                                                        Derivation
                                                                                                                                                        1. Initial program 99.5%

                                                                                                                                                          \[\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} \]
                                                                                                                                                        2. Step-by-step derivation
                                                                                                                                                          1. Applied rewrites99.5%

                                                                                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\frac{e^{\frac{r}{-3 \cdot s}}}{\pi}, 0.125, \frac{e^{\frac{-r}{s}}}{\pi} \cdot 0.125\right)}{s \cdot r} \]
                                                                                                                                                          2. Taylor expanded in s around inf

                                                                                                                                                            \[\leadsto \frac{\frac{\frac{1}{4}}{\pi}}{s \cdot r} \]
                                                                                                                                                          3. Step-by-step derivation
                                                                                                                                                            1. Applied rewrites9.4%

                                                                                                                                                              \[\leadsto \frac{\frac{0.25}{\pi}}{s \cdot r} \]
                                                                                                                                                            2. Evaluated real constant9.4%

                                                                                                                                                              \[\leadsto \frac{0.07957746833562851}{s \cdot r} \]
                                                                                                                                                            3. Add Preprocessing

                                                                                                                                                            Reproduce

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