Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 95.9% → 98.3%
Time: 6.5s
Alternatives: 17
Speedup: 1.4×

Specification

?
\[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
\[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
(FPCore (s u)
  :precision binary32
  :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
  (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75))))))
float code(float s, float u) {
	return (3.0f * s) * logf((1.0f / (1.0f - ((u - 0.25f) / 0.75f))));
}
real(4) function code(s, u)
use fmin_fmax_functions
    real(4), intent (in) :: s
    real(4), intent (in) :: u
    code = (3.0e0 * s) * log((1.0e0 / (1.0e0 - ((u - 0.25e0) / 0.75e0))))
end function
function code(s, u)
	return Float32(Float32(Float32(3.0) * s) * log(Float32(Float32(1.0) / Float32(Float32(1.0) - Float32(Float32(u - Float32(0.25)) / Float32(0.75))))))
end
function tmp = code(s, u)
	tmp = (single(3.0) * s) * log((single(1.0) / (single(1.0) - ((u - single(0.25)) / single(0.75)))));
end
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)

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

\[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
\[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
(FPCore (s u)
  :precision binary32
  :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
  (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75))))))
float code(float s, float u) {
	return (3.0f * s) * logf((1.0f / (1.0f - ((u - 0.25f) / 0.75f))));
}
real(4) function code(s, u)
use fmin_fmax_functions
    real(4), intent (in) :: s
    real(4), intent (in) :: u
    code = (3.0e0 * s) * log((1.0e0 / (1.0e0 - ((u - 0.25e0) / 0.75e0))))
end function
function code(s, u)
	return Float32(Float32(Float32(3.0) * s) * log(Float32(Float32(1.0) / Float32(Float32(1.0) - Float32(Float32(u - Float32(0.25)) / Float32(0.75))))))
end
function tmp = code(s, u)
	tmp = (single(3.0) * s) * log((single(1.0) / (single(1.0) - ((u - single(0.25)) / single(0.75)))));
end
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)

Alternative 1: 98.3% accurate, 1.0× speedup?

\[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
\[-\left(\mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right) \cdot s\right) \cdot 3 \]
(FPCore (s u)
  :precision binary32
  :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
  (- (* (* (log1p (/ (- 0.25 u) 0.75)) s) 3.0)))
float code(float s, float u) {
	return -((log1pf(((0.25f - u) / 0.75f)) * s) * 3.0f);
}
function code(s, u)
	return Float32(-Float32(Float32(log1p(Float32(Float32(Float32(0.25) - u) / Float32(0.75))) * s) * Float32(3.0)))
end
-\left(\mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right) \cdot s\right) \cdot 3
Derivation
  1. Initial program 95.9%

    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
  2. Step-by-step derivation
    1. Applied rewrites96.3%

      \[\leadsto -\left(\log \left(\left(u - 1\right) \cdot -1.3333333333333333\right) \cdot s\right) \cdot 3 \]
    2. Step-by-step derivation
      1. Applied rewrites97.9%

        \[\leadsto -\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \cdot s\right) \cdot 3 \]
      2. Step-by-step derivation
        1. Applied rewrites98.3%

          \[\leadsto -\left(\mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right) \cdot s\right) \cdot 3 \]
        2. Add Preprocessing

        Alternative 2: 98.2% accurate, 1.1× speedup?

        \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
        \[\frac{\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \cdot s}{-0.3333333333333333} \]
        (FPCore (s u)
          :precision binary32
          :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
          (/
         (* (log1p (fma -1.3333333333333333 u 0.3333333333333333)) s)
         -0.3333333333333333))
        float code(float s, float u) {
        	return (log1pf(fmaf(-1.3333333333333333f, u, 0.3333333333333333f)) * s) / -0.3333333333333333f;
        }
        
        function code(s, u)
        	return Float32(Float32(log1p(fma(Float32(-1.3333333333333333), u, Float32(0.3333333333333333))) * s) / Float32(-0.3333333333333333))
        end
        
        \frac{\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \cdot s}{-0.3333333333333333}
        
        Derivation
        1. Initial program 95.9%

          \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
        2. Step-by-step derivation
          1. Applied rewrites96.3%

            \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{-0.75}{u - 1}\right) \]
          2. Applied rewrites95.6%

            \[\leadsto \mathsf{fma}\left(\log \left(\left|u - 1\right|\right), -3 \cdot s, \log 1.3333333333333333 \cdot \left(-3 \cdot s\right)\right) \]
          3. Step-by-step derivation
            1. Applied rewrites96.4%

              \[\leadsto \frac{\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot s}{-0.3333333333333333} \]
            2. Step-by-step derivation
              1. Applied rewrites98.2%

                \[\leadsto \frac{\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \cdot s}{-0.3333333333333333} \]
              2. Add Preprocessing

              Alternative 3: 98.2% accurate, 1.1× speedup?

              \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
              \[s \cdot \frac{\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)}{-0.3333333333333333} \]
              (FPCore (s u)
                :precision binary32
                :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                (*
               s
               (/
                (log1p (fma -1.3333333333333333 u 0.3333333333333333))
                -0.3333333333333333)))
              float code(float s, float u) {
              	return s * (log1pf(fmaf(-1.3333333333333333f, u, 0.3333333333333333f)) / -0.3333333333333333f);
              }
              
              function code(s, u)
              	return Float32(s * Float32(log1p(fma(Float32(-1.3333333333333333), u, Float32(0.3333333333333333))) / Float32(-0.3333333333333333)))
              end
              
              s \cdot \frac{\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)}{-0.3333333333333333}
              
              Derivation
              1. Initial program 95.9%

                \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
              2. Step-by-step derivation
                1. Applied rewrites96.3%

                  \[\leadsto s \cdot \left(-3 \cdot \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \]
                2. Step-by-step derivation
                  1. Applied rewrites97.9%

                    \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)\right) \]
                  2. Step-by-step derivation
                    1. Applied rewrites96.8%

                      \[\leadsto s \cdot \frac{\log \left(1 - \mathsf{fma}\left(1.3333333333333333, u, -0.3333333333333333\right)\right)}{-0.3333333333333333} \]
                    2. Applied rewrites98.2%

                      \[\leadsto s \cdot \frac{\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)}{-0.3333333333333333} \]
                    3. Add Preprocessing

                    Alternative 4: 97.9% accurate, 1.2× speedup?

                    \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                    \[-3 \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \cdot s\right) \]
                    (FPCore (s u)
                      :precision binary32
                      :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                      (* -3.0 (* (log1p (fma -1.3333333333333333 u 0.3333333333333333)) s)))
                    float code(float s, float u) {
                    	return -3.0f * (log1pf(fmaf(-1.3333333333333333f, u, 0.3333333333333333f)) * s);
                    }
                    
                    function code(s, u)
                    	return Float32(Float32(-3.0) * Float32(log1p(fma(Float32(-1.3333333333333333), u, Float32(0.3333333333333333))) * s))
                    end
                    
                    -3 \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \cdot s\right)
                    
                    Derivation
                    1. Initial program 95.9%

                      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                    2. Step-by-step derivation
                      1. Applied rewrites96.3%

                        \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{-0.75}{u - 1}\right) \]
                      2. Applied rewrites96.9%

                        \[\leadsto -3 \cdot \left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot s\right) \]
                      3. Step-by-step derivation
                        1. Applied rewrites96.3%

                          \[\leadsto -3 \cdot \left(\log \left(-1.3333333333333333 \cdot \left(u - 1\right)\right) \cdot s\right) \]
                        2. Step-by-step derivation
                          1. Applied rewrites97.9%

                            \[\leadsto -3 \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \cdot s\right) \]
                          2. Add Preprocessing

                          Alternative 5: 97.0% accurate, 1.2× speedup?

                          \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                          \[\left(\left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot -1.3333333333333333\right) \cdot s\right) \cdot 2.25 \]
                          (FPCore (s u)
                            :precision binary32
                            :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                            (*
                           (*
                            (*
                             (log (fma -1.3333333333333333 u 1.3333333333333333))
                             -1.3333333333333333)
                            s)
                           2.25))
                          float code(float s, float u) {
                          	return ((logf(fmaf(-1.3333333333333333f, u, 1.3333333333333333f)) * -1.3333333333333333f) * s) * 2.25f;
                          }
                          
                          function code(s, u)
                          	return Float32(Float32(Float32(log(fma(Float32(-1.3333333333333333), u, Float32(1.3333333333333333))) * Float32(-1.3333333333333333)) * s) * Float32(2.25))
                          end
                          
                          \left(\left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot -1.3333333333333333\right) \cdot s\right) \cdot 2.25
                          
                          Derivation
                          1. Initial program 95.9%

                            \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                          2. Step-by-step derivation
                            1. Applied rewrites96.3%

                              \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{-0.75}{u - 1}\right) \]
                            2. Applied rewrites95.6%

                              \[\leadsto \mathsf{fma}\left(\log \left(\left|u - 1\right|\right), -3 \cdot s, \log 1.3333333333333333 \cdot \left(-3 \cdot s\right)\right) \]
                            3. Applied rewrites97.0%

                              \[\leadsto \left(\left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot -1.3333333333333333\right) \cdot s\right) \cdot 2.25 \]
                            4. Add Preprocessing

                            Alternative 6: 97.0% accurate, 1.2× speedup?

                            \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                            \[\left(-2.25 \cdot \log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right)\right) \cdot \left(1.3333333333333333 \cdot s\right) \]
                            (FPCore (s u)
                              :precision binary32
                              :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                              (*
                             (* -2.25 (log (fma -1.3333333333333333 u 1.3333333333333333)))
                             (* 1.3333333333333333 s)))
                            float code(float s, float u) {
                            	return (-2.25f * logf(fmaf(-1.3333333333333333f, u, 1.3333333333333333f))) * (1.3333333333333333f * s);
                            }
                            
                            function code(s, u)
                            	return Float32(Float32(Float32(-2.25) * log(fma(Float32(-1.3333333333333333), u, Float32(1.3333333333333333)))) * Float32(Float32(1.3333333333333333) * s))
                            end
                            
                            \left(-2.25 \cdot \log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right)\right) \cdot \left(1.3333333333333333 \cdot s\right)
                            
                            Derivation
                            1. Initial program 95.9%

                              \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                            2. Step-by-step derivation
                              1. Applied rewrites96.3%

                                \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{-0.75}{u - 1}\right) \]
                              2. Applied rewrites95.8%

                                \[\leadsto \log \left(\sqrt{\left|\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right|}\right) \cdot \left(s \cdot -6\right) \]
                              3. Step-by-step derivation
                                1. Applied rewrites95.8%

                                  \[\leadsto -6 \cdot \left(\log \left(\sqrt{\left|\mathsf{fma}\left(1.3333333333333333, u, -1.3333333333333333\right)\right|}\right) \cdot s\right) \]
                                2. Applied rewrites97.0%

                                  \[\leadsto \left(-2.25 \cdot \log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right)\right) \cdot \left(1.3333333333333333 \cdot s\right) \]
                                3. Add Preprocessing

                                Alternative 7: 96.9% accurate, 1.4× speedup?

                                \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                \[s \cdot \mathsf{fma}\left(-3, \log \left(\left|u - 1\right|\right), -0.8630462288856506\right) \]
                                (FPCore (s u)
                                  :precision binary32
                                  :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                  (* s (fma -3.0 (log (fabs (- u 1.0))) -0.8630462288856506)))
                                float code(float s, float u) {
                                	return s * fmaf(-3.0f, logf(fabsf((u - 1.0f))), -0.8630462288856506f);
                                }
                                
                                function code(s, u)
                                	return Float32(s * fma(Float32(-3.0), log(abs(Float32(u - Float32(1.0)))), Float32(-0.8630462288856506)))
                                end
                                
                                s \cdot \mathsf{fma}\left(-3, \log \left(\left|u - 1\right|\right), -0.8630462288856506\right)
                                
                                Derivation
                                1. Initial program 95.9%

                                  \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                2. Step-by-step derivation
                                  1. Applied rewrites96.3%

                                    \[\leadsto s \cdot \left(-3 \cdot \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \]
                                  2. Step-by-step derivation
                                    1. Applied rewrites96.8%

                                      \[\leadsto s \cdot \mathsf{fma}\left(-3, \log \left(\left|u - 1\right|\right), \log 0.421875\right) \]
                                    2. Evaluated real constant96.8%

                                      \[\leadsto s \cdot \mathsf{fma}\left(-3, \log \left(\left|u - 1\right|\right), -0.8630462288856506\right) \]
                                    3. Add Preprocessing

                                    Alternative 8: 96.9% accurate, 1.4× speedup?

                                    \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                    \[\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot \left(-3 \cdot s\right) \]
                                    (FPCore (s u)
                                      :precision binary32
                                      :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                      (* (log (fma -1.3333333333333333 u 1.3333333333333333)) (* -3.0 s)))
                                    float code(float s, float u) {
                                    	return logf(fmaf(-1.3333333333333333f, u, 1.3333333333333333f)) * (-3.0f * s);
                                    }
                                    
                                    function code(s, u)
                                    	return Float32(log(fma(Float32(-1.3333333333333333), u, Float32(1.3333333333333333))) * Float32(Float32(-3.0) * s))
                                    end
                                    
                                    \log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot \left(-3 \cdot s\right)
                                    
                                    Derivation
                                    1. Initial program 95.9%

                                      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites96.3%

                                        \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{-0.75}{u - 1}\right) \]
                                      2. Applied rewrites96.9%

                                        \[\leadsto \log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot \left(-3 \cdot s\right) \]
                                      3. Add Preprocessing

                                      Alternative 9: 96.8% accurate, 1.4× speedup?

                                      \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                      \[-3 \cdot \left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot s\right) \]
                                      (FPCore (s u)
                                        :precision binary32
                                        :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                        (* -3.0 (* (log (fma -1.3333333333333333 u 1.3333333333333333)) s)))
                                      float code(float s, float u) {
                                      	return -3.0f * (logf(fmaf(-1.3333333333333333f, u, 1.3333333333333333f)) * s);
                                      }
                                      
                                      function code(s, u)
                                      	return Float32(Float32(-3.0) * Float32(log(fma(Float32(-1.3333333333333333), u, Float32(1.3333333333333333))) * s))
                                      end
                                      
                                      -3 \cdot \left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot s\right)
                                      
                                      Derivation
                                      1. Initial program 95.9%

                                        \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites96.3%

                                          \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{-0.75}{u - 1}\right) \]
                                        2. Applied rewrites96.9%

                                          \[\leadsto -3 \cdot \left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot s\right) \]
                                        3. Add Preprocessing

                                        Alternative 10: 36.7% accurate, 1.4× speedup?

                                        \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                        \[s \cdot \left(u \cdot \left(3 + u \cdot \left(1.5 + u\right)\right) + -0.8630462288856506\right) \]
                                        (FPCore (s u)
                                          :precision binary32
                                          :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                          (* s (+ (* u (+ 3.0 (* u (+ 1.5 u)))) -0.8630462288856506)))
                                        float code(float s, float u) {
                                        	return s * ((u * (3.0f + (u * (1.5f + u)))) + -0.8630462288856506f);
                                        }
                                        
                                        real(4) function code(s, u)
                                        use fmin_fmax_functions
                                            real(4), intent (in) :: s
                                            real(4), intent (in) :: u
                                            code = s * ((u * (3.0e0 + (u * (1.5e0 + u)))) + (-0.8630462288856506e0))
                                        end function
                                        
                                        function code(s, u)
                                        	return Float32(s * Float32(Float32(u * Float32(Float32(3.0) + Float32(u * Float32(Float32(1.5) + u)))) + Float32(-0.8630462288856506)))
                                        end
                                        
                                        function tmp = code(s, u)
                                        	tmp = s * ((u * (single(3.0) + (u * (single(1.5) + u)))) + single(-0.8630462288856506));
                                        end
                                        
                                        s \cdot \left(u \cdot \left(3 + u \cdot \left(1.5 + u\right)\right) + -0.8630462288856506\right)
                                        
                                        Derivation
                                        1. Initial program 95.9%

                                          \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites96.3%

                                            \[\leadsto s \cdot \left(-3 \cdot \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites96.5%

                                              \[\leadsto s \cdot \left(-3 \cdot \log \left(\left|u - 1\right|\right) + \log 0.421875\right) \]
                                            2. Evaluated real constant96.5%

                                              \[\leadsto s \cdot \left(-3 \cdot \log \left(\left|u - 1\right|\right) + -0.8630462288856506\right) \]
                                            3. Taylor expanded in u around 0

                                              \[\leadsto s \cdot \left(u \cdot \left(3 + u \cdot \left(\frac{3}{2} + u\right)\right) + -0.8630462288856506\right) \]
                                            4. Step-by-step derivation
                                              1. Applied rewrites36.7%

                                                \[\leadsto s \cdot \left(u \cdot \left(3 + u \cdot \left(1.5 + u\right)\right) + -0.8630462288856506\right) \]
                                              2. Add Preprocessing

                                              Alternative 11: 32.2% accurate, 1.7× speedup?

                                              \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                              \[s \cdot \left(u \cdot \left(3 + 1.5 \cdot u\right) + -0.8630462288856506\right) \]
                                              (FPCore (s u)
                                                :precision binary32
                                                :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                (* s (+ (* u (+ 3.0 (* 1.5 u))) -0.8630462288856506)))
                                              float code(float s, float u) {
                                              	return s * ((u * (3.0f + (1.5f * u))) + -0.8630462288856506f);
                                              }
                                              
                                              real(4) function code(s, u)
                                              use fmin_fmax_functions
                                                  real(4), intent (in) :: s
                                                  real(4), intent (in) :: u
                                                  code = s * ((u * (3.0e0 + (1.5e0 * u))) + (-0.8630462288856506e0))
                                              end function
                                              
                                              function code(s, u)
                                              	return Float32(s * Float32(Float32(u * Float32(Float32(3.0) + Float32(Float32(1.5) * u))) + Float32(-0.8630462288856506)))
                                              end
                                              
                                              function tmp = code(s, u)
                                              	tmp = s * ((u * (single(3.0) + (single(1.5) * u))) + single(-0.8630462288856506));
                                              end
                                              
                                              s \cdot \left(u \cdot \left(3 + 1.5 \cdot u\right) + -0.8630462288856506\right)
                                              
                                              Derivation
                                              1. Initial program 95.9%

                                                \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites96.3%

                                                  \[\leadsto s \cdot \left(-3 \cdot \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \]
                                                2. Step-by-step derivation
                                                  1. Applied rewrites96.5%

                                                    \[\leadsto s \cdot \left(-3 \cdot \log \left(\left|u - 1\right|\right) + \log 0.421875\right) \]
                                                  2. Evaluated real constant96.5%

                                                    \[\leadsto s \cdot \left(-3 \cdot \log \left(\left|u - 1\right|\right) + -0.8630462288856506\right) \]
                                                  3. Taylor expanded in u around 0

                                                    \[\leadsto s \cdot \left(u \cdot \left(3 + \frac{3}{2} \cdot u\right) + -0.8630462288856506\right) \]
                                                  4. Step-by-step derivation
                                                    1. Applied rewrites32.2%

                                                      \[\leadsto s \cdot \left(u \cdot \left(3 + 1.5 \cdot u\right) + -0.8630462288856506\right) \]
                                                    2. Add Preprocessing

                                                    Alternative 12: 25.8% accurate, 2.7× speedup?

                                                    \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                                    \[s \cdot \left(3 \cdot u + -0.8630462288856506\right) \]
                                                    (FPCore (s u)
                                                      :precision binary32
                                                      :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                      (* s (+ (* 3.0 u) -0.8630462288856506)))
                                                    float code(float s, float u) {
                                                    	return s * ((3.0f * u) + -0.8630462288856506f);
                                                    }
                                                    
                                                    real(4) function code(s, u)
                                                    use fmin_fmax_functions
                                                        real(4), intent (in) :: s
                                                        real(4), intent (in) :: u
                                                        code = s * ((3.0e0 * u) + (-0.8630462288856506e0))
                                                    end function
                                                    
                                                    function code(s, u)
                                                    	return Float32(s * Float32(Float32(Float32(3.0) * u) + Float32(-0.8630462288856506)))
                                                    end
                                                    
                                                    function tmp = code(s, u)
                                                    	tmp = s * ((single(3.0) * u) + single(-0.8630462288856506));
                                                    end
                                                    
                                                    s \cdot \left(3 \cdot u + -0.8630462288856506\right)
                                                    
                                                    Derivation
                                                    1. Initial program 95.9%

                                                      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                                    2. Step-by-step derivation
                                                      1. Applied rewrites96.3%

                                                        \[\leadsto s \cdot \left(-3 \cdot \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \]
                                                      2. Step-by-step derivation
                                                        1. Applied rewrites96.5%

                                                          \[\leadsto s \cdot \left(-3 \cdot \log \left(\left|u - 1\right|\right) + \log 0.421875\right) \]
                                                        2. Taylor expanded in u around 0

                                                          \[\leadsto s \cdot \left(3 \cdot u + \log 0.421875\right) \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites25.8%

                                                            \[\leadsto s \cdot \left(3 \cdot u + \log 0.421875\right) \]
                                                          2. Evaluated real constant25.8%

                                                            \[\leadsto s \cdot \left(3 \cdot u + -0.8630462288856506\right) \]
                                                          3. Add Preprocessing

                                                          Alternative 13: 25.8% accurate, 2.7× speedup?

                                                          \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                                          \[3 \cdot \left(\left(-0.28768208622932434 + u\right) \cdot s\right) \]
                                                          (FPCore (s u)
                                                            :precision binary32
                                                            :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                            (* 3.0 (* (+ -0.28768208622932434 u) s)))
                                                          float code(float s, float u) {
                                                          	return 3.0f * ((-0.28768208622932434f + u) * s);
                                                          }
                                                          
                                                          real(4) function code(s, u)
                                                          use fmin_fmax_functions
                                                              real(4), intent (in) :: s
                                                              real(4), intent (in) :: u
                                                              code = 3.0e0 * (((-0.28768208622932434e0) + u) * s)
                                                          end function
                                                          
                                                          function code(s, u)
                                                          	return Float32(Float32(3.0) * Float32(Float32(Float32(-0.28768208622932434) + u) * s))
                                                          end
                                                          
                                                          function tmp = code(s, u)
                                                          	tmp = single(3.0) * ((single(-0.28768208622932434) + u) * s);
                                                          end
                                                          
                                                          3 \cdot \left(\left(-0.28768208622932434 + u\right) \cdot s\right)
                                                          
                                                          Derivation
                                                          1. Initial program 95.9%

                                                            \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                                          2. Taylor expanded in u around 0

                                                            \[\leadsto \left(3 \cdot s\right) \cdot \left(u + \log \frac{3}{4}\right) \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites25.8%

                                                              \[\leadsto \left(3 \cdot s\right) \cdot \left(u + \log 0.75\right) \]
                                                            2. Applied rewrites25.8%

                                                              \[\leadsto 3 \cdot \left(\left(\log 0.75 + u\right) \cdot s\right) \]
                                                            3. Evaluated real constant25.8%

                                                              \[\leadsto 3 \cdot \left(\left(-0.28768208622932434 + u\right) \cdot s\right) \]
                                                            4. Add Preprocessing

                                                            Alternative 14: 10.5% accurate, 3.7× speedup?

                                                            \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                                            \[0 \cdot \left(s \cdot -0.28768208622932434\right) \]
                                                            (FPCore (s u)
                                                              :precision binary32
                                                              :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                              (* 0.0 (* s -0.28768208622932434)))
                                                            float code(float s, float u) {
                                                            	return 0.0f * (s * -0.28768208622932434f);
                                                            }
                                                            
                                                            real(4) function code(s, u)
                                                            use fmin_fmax_functions
                                                                real(4), intent (in) :: s
                                                                real(4), intent (in) :: u
                                                                code = 0.0e0 * (s * (-0.28768208622932434e0))
                                                            end function
                                                            
                                                            function code(s, u)
                                                            	return Float32(Float32(0.0) * Float32(s * Float32(-0.28768208622932434)))
                                                            end
                                                            
                                                            function tmp = code(s, u)
                                                            	tmp = single(0.0) * (s * single(-0.28768208622932434));
                                                            end
                                                            
                                                            0 \cdot \left(s \cdot -0.28768208622932434\right)
                                                            
                                                            Derivation
                                                            1. Initial program 95.9%

                                                              \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                                            2. Taylor expanded in u around 0

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

                                                                \[\leadsto 3 \cdot \left(s \cdot \log 0.75\right) \]
                                                              2. Evaluated real constant7.4%

                                                                \[\leadsto 3 \cdot \left(s \cdot -0.28768208622932434\right) \]
                                                              3. Taylor expanded in undef-var around zero

                                                                \[\leadsto 0 \cdot \left(s \cdot -0.28768208622932434\right) \]
                                                              4. Step-by-step derivation
                                                                1. Applied rewrites10.5%

                                                                  \[\leadsto 0 \cdot \left(s \cdot -0.28768208622932434\right) \]
                                                                2. Add Preprocessing

                                                                Alternative 15: 7.4% accurate, 3.7× speedup?

                                                                \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                                                \[3 \cdot \left(s \cdot -0.28768208622932434\right) \]
                                                                (FPCore (s u)
                                                                  :precision binary32
                                                                  :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                                  (* 3.0 (* s -0.28768208622932434)))
                                                                float code(float s, float u) {
                                                                	return 3.0f * (s * -0.28768208622932434f);
                                                                }
                                                                
                                                                real(4) function code(s, u)
                                                                use fmin_fmax_functions
                                                                    real(4), intent (in) :: s
                                                                    real(4), intent (in) :: u
                                                                    code = 3.0e0 * (s * (-0.28768208622932434e0))
                                                                end function
                                                                
                                                                function code(s, u)
                                                                	return Float32(Float32(3.0) * Float32(s * Float32(-0.28768208622932434)))
                                                                end
                                                                
                                                                function tmp = code(s, u)
                                                                	tmp = single(3.0) * (s * single(-0.28768208622932434));
                                                                end
                                                                
                                                                3 \cdot \left(s \cdot -0.28768208622932434\right)
                                                                
                                                                Derivation
                                                                1. Initial program 95.9%

                                                                  \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                                                2. Taylor expanded in u around 0

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

                                                                    \[\leadsto 3 \cdot \left(s \cdot \log 0.75\right) \]
                                                                  2. Evaluated real constant7.4%

                                                                    \[\leadsto 3 \cdot \left(s \cdot -0.28768208622932434\right) \]
                                                                  3. Add Preprocessing

                                                                  Alternative 16: 7.4% accurate, 6.4× speedup?

                                                                  \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                                                  \[s \cdot -0.8630462288856506 \]
                                                                  (FPCore (s u)
                                                                    :precision binary32
                                                                    :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                                    (* s -0.8630462288856506))
                                                                  float code(float s, float u) {
                                                                  	return s * -0.8630462288856506f;
                                                                  }
                                                                  
                                                                  real(4) function code(s, u)
                                                                  use fmin_fmax_functions
                                                                      real(4), intent (in) :: s
                                                                      real(4), intent (in) :: u
                                                                      code = s * (-0.8630462288856506e0)
                                                                  end function
                                                                  
                                                                  function code(s, u)
                                                                  	return Float32(s * Float32(-0.8630462288856506))
                                                                  end
                                                                  
                                                                  function tmp = code(s, u)
                                                                  	tmp = s * single(-0.8630462288856506);
                                                                  end
                                                                  
                                                                  s \cdot -0.8630462288856506
                                                                  
                                                                  Derivation
                                                                  1. Initial program 95.9%

                                                                    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                                                  2. Step-by-step derivation
                                                                    1. Applied rewrites96.3%

                                                                      \[\leadsto s \cdot \left(-3 \cdot \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \]
                                                                    2. Step-by-step derivation
                                                                      1. Applied rewrites96.5%

                                                                        \[\leadsto s \cdot \left(-3 \cdot \log \left(\left|u - 1\right|\right) + \log 0.421875\right) \]
                                                                      2. Evaluated real constant96.5%

                                                                        \[\leadsto s \cdot \left(-3 \cdot \log \left(\left|u - 1\right|\right) + -0.8630462288856506\right) \]
                                                                      3. Taylor expanded in u around 0

                                                                        \[\leadsto s \cdot \frac{-14479513}{16777216} \]
                                                                      4. Step-by-step derivation
                                                                        1. Applied rewrites7.4%

                                                                          \[\leadsto s \cdot -0.8630462288856506 \]
                                                                        2. Add Preprocessing

                                                                        Alternative 17: 7.4% accurate, 6.4× speedup?

                                                                        \[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
                                                                        \[-0.863046258687973 \cdot s \]
                                                                        (FPCore (s u)
                                                                          :precision binary32
                                                                          :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                                          (* -0.863046258687973 s))
                                                                        float code(float s, float u) {
                                                                        	return -0.863046258687973f * s;
                                                                        }
                                                                        
                                                                        real(4) function code(s, u)
                                                                        use fmin_fmax_functions
                                                                            real(4), intent (in) :: s
                                                                            real(4), intent (in) :: u
                                                                            code = (-0.863046258687973e0) * s
                                                                        end function
                                                                        
                                                                        function code(s, u)
                                                                        	return Float32(Float32(-0.863046258687973) * s)
                                                                        end
                                                                        
                                                                        function tmp = code(s, u)
                                                                        	tmp = single(-0.863046258687973) * s;
                                                                        end
                                                                        
                                                                        -0.863046258687973 \cdot s
                                                                        
                                                                        Derivation
                                                                        1. Initial program 95.9%

                                                                          \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
                                                                        2. Taylor expanded in u around 0

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

                                                                            \[\leadsto 3 \cdot \left(s \cdot \log 0.75\right) \]
                                                                          2. Evaluated real constant7.4%

                                                                            \[\leadsto 3 \cdot \left(s \cdot -0.28768208622932434\right) \]
                                                                          3. Applied rewrites7.4%

                                                                            \[\leadsto -0.863046258687973 \cdot s \]
                                                                          4. Add Preprocessing

                                                                          Reproduce

                                                                          ?
                                                                          herbie shell --seed 2026084 
                                                                          (FPCore (s u)
                                                                            :name "Disney BSSRDF, sample scattering profile, upper"
                                                                            :precision binary32
                                                                            :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                                            (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75))))))