Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 95.8% → 98.3%
Time: 5.7s
Alternatives: 15
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 15 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.8% 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(-3 \cdot \mathsf{log1p}\left(\frac{\left(0.25 - u\right) \cdot 1}{0.75}\right)\right) \cdot s \]
(FPCore (s u)
  :precision binary32
  :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
  (* (* -3.0 (log1p (/ (* (- 0.25 u) 1.0) 0.75))) s))
float code(float s, float u) {
	return (-3.0f * log1pf((((0.25f - u) * 1.0f) / 0.75f))) * s;
}
function code(s, u)
	return Float32(Float32(Float32(-3.0) * log1p(Float32(Float32(Float32(Float32(0.25) - u) * Float32(1.0)) / Float32(0.75)))) * s)
end
\left(-3 \cdot \mathsf{log1p}\left(\frac{\left(0.25 - u\right) \cdot 1}{0.75}\right)\right) \cdot s
Derivation
  1. Initial program 95.8%

    \[\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 \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \cdot s \]
    2. Step-by-step derivation
      1. Applied rewrites97.9%

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

          \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{\left(0.25 - u\right) \cdot 1}{0.75}\right)\right) \cdot s \]
        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)}{0.3333333333333333} \cdot s \]
        (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)))
          0.3333333333333333)
         s))
        float code(float s, float u) {
        	return (-log1pf(fmaf(-1.3333333333333333f, u, 0.3333333333333333f)) / 0.3333333333333333f) * s;
        }
        
        function code(s, u)
        	return Float32(Float32(Float32(-log1p(fma(Float32(-1.3333333333333333), u, Float32(0.3333333333333333)))) / Float32(0.3333333333333333)) * s)
        end
        
        \frac{-\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)}{0.3333333333333333} \cdot s
        
        Derivation
        1. Initial program 95.8%

          \[\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 \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \cdot s \]
          2. Step-by-step derivation
            1. Applied rewrites96.5%

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

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

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

              Alternative 3: 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)\]
              \[\left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)\right) \cdot s \]
              (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(Float32(-3.0) * log1p(fma(Float32(-1.3333333333333333), u, Float32(0.3333333333333333)))) * s)
              end
              
              \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)\right) \cdot s
              
              Derivation
              1. Initial program 95.8%

                \[\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 \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \cdot s \]
                2. Step-by-step derivation
                  1. Applied rewrites97.9%

                    \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)\right) \cdot s \]
                  2. 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)\]
                  \[\mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.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)))
                    (* (log1p (fma -1.3333333333333333 u 0.3333333333333333)) (* -3.0 s)))
                  float code(float s, float u) {
                  	return log1pf(fmaf(-1.3333333333333333f, u, 0.3333333333333333f)) * (-3.0f * s);
                  }
                  
                  function code(s, u)
                  	return Float32(log1p(fma(Float32(-1.3333333333333333), u, Float32(0.3333333333333333))) * Float32(Float32(-3.0) * s))
                  end
                  
                  \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \cdot \left(-3 \cdot s\right)
                  
                  Derivation
                  1. Initial program 95.8%

                    \[\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 rewrites25.4%

                      \[\leadsto \log \left({\left(\left(u - 1\right) \cdot -1.3333333333333333\right)}^{\left(\left(s \cdot 3\right) \cdot -1\right)}\right) \]
                    2. Applied rewrites96.0%

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

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

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

                      Alternative 5: 97.8% 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(s \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)\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 (log1p (fma -1.3333333333333333 u 0.3333333333333333)))))
                      float code(float s, float u) {
                      	return -3.0f * (s * log1pf(fmaf(-1.3333333333333333f, u, 0.3333333333333333f)));
                      }
                      
                      function code(s, u)
                      	return Float32(Float32(-3.0) * Float32(s * log1p(fma(Float32(-1.3333333333333333), u, Float32(0.3333333333333333)))))
                      end
                      
                      -3 \cdot \left(s \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)\right)
                      
                      Derivation
                      1. Initial program 95.8%

                        \[\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.8%

                          \[\leadsto \left(3 \cdot s\right) \cdot \left(0 - \log \left(\left|\mathsf{fma}\left(1.3333333333333333, u, -1.3333333333333333\right) \cdot 1\right|\right)\right) \]
                        2. Taylor expanded in s around 0

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

                            \[\leadsto -3 \cdot \left(s \cdot \log \left(\left|1.3333333333333333 \cdot u - 1.3333333333333333\right|\right)\right) \]
                          2. Applied rewrites97.8%

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

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

                            \[\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 \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \cdot s \]
                            2. Step-by-step derivation
                              1. Applied rewrites96.7%

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

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

                              Alternative 7: 96.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)\]
                              \[\left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot -3\right) \cdot s \]
                              (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(Float32(log(fma(Float32(-1.3333333333333333), u, Float32(1.3333333333333333))) * Float32(-3.0)) * s)
                              end
                              
                              \left(\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right) \cdot -3\right) \cdot s
                              
                              Derivation
                              1. Initial program 95.8%

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

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

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

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

                                Alternative 8: 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)\]
                                \[\left(u \cdot \left(3 + u \cdot \left(1.5 + u\right)\right) + -0.8630462288856506\right) \cdot s \]
                                (FPCore (s u)
                                  :precision binary32
                                  :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                  (* (+ (* u (+ 3.0 (* u (+ 1.5 u)))) -0.8630462288856506) s))
                                float code(float s, float u) {
                                	return ((u * (3.0f + (u * (1.5f + u)))) + -0.8630462288856506f) * s;
                                }
                                
                                real(4) function code(s, u)
                                use fmin_fmax_functions
                                    real(4), intent (in) :: s
                                    real(4), intent (in) :: u
                                    code = ((u * (3.0e0 + (u * (1.5e0 + u)))) + (-0.8630462288856506e0)) * s
                                end function
                                
                                function code(s, u)
                                	return Float32(Float32(Float32(u * Float32(Float32(3.0) + Float32(u * Float32(Float32(1.5) + u)))) + Float32(-0.8630462288856506)) * s)
                                end
                                
                                function tmp = code(s, u)
                                	tmp = ((u * (single(3.0) + (u * (single(1.5) + u)))) + single(-0.8630462288856506)) * s;
                                end
                                
                                \left(u \cdot \left(3 + u \cdot \left(1.5 + u\right)\right) + -0.8630462288856506\right) \cdot s
                                
                                Derivation
                                1. Initial program 95.8%

                                  \[\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 \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \cdot s \]
                                  2. Step-by-step derivation
                                    1. Applied rewrites96.4%

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

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

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

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

                                      Alternative 9: 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)\]
                                      \[\left(u \cdot \left(3 + 1.5 \cdot u\right) + -0.8630462288856506\right) \cdot s \]
                                      (FPCore (s u)
                                        :precision binary32
                                        :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                        (* (+ (* u (+ 3.0 (* 1.5 u))) -0.8630462288856506) s))
                                      float code(float s, float u) {
                                      	return ((u * (3.0f + (1.5f * u))) + -0.8630462288856506f) * s;
                                      }
                                      
                                      real(4) function code(s, u)
                                      use fmin_fmax_functions
                                          real(4), intent (in) :: s
                                          real(4), intent (in) :: u
                                          code = ((u * (3.0e0 + (1.5e0 * u))) + (-0.8630462288856506e0)) * s
                                      end function
                                      
                                      function code(s, u)
                                      	return Float32(Float32(Float32(u * Float32(Float32(3.0) + Float32(Float32(1.5) * u))) + Float32(-0.8630462288856506)) * s)
                                      end
                                      
                                      function tmp = code(s, u)
                                      	tmp = ((u * (single(3.0) + (single(1.5) * u))) + single(-0.8630462288856506)) * s;
                                      end
                                      
                                      \left(u \cdot \left(3 + 1.5 \cdot u\right) + -0.8630462288856506\right) \cdot s
                                      
                                      Derivation
                                      1. Initial program 95.8%

                                        \[\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 \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \cdot s \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites96.4%

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

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

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

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

                                            Alternative 10: 25.7% accurate, 2.7× speedup?

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

                                              \[\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 \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \cdot s \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites96.4%

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

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

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

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

                                                  Alternative 11: 25.7% accurate, 2.7× speedup?

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

                                                    \[\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.7%

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

                                                      \[\leadsto \left(3 \cdot s\right) \cdot \left(u + -0.28768208622932434\right) \]
                                                    3. Applied rewrites25.7%

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

                                                    Alternative 12: 25.7% accurate, 2.7× 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 \left(u + -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) (+ u -0.28768208622932434)))
                                                    float code(float s, float u) {
                                                    	return (3.0f * s) * (u + -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) * (u + (-0.28768208622932434e0))
                                                    end function
                                                    
                                                    function code(s, u)
                                                    	return Float32(Float32(Float32(3.0) * s) * Float32(u + Float32(-0.28768208622932434)))
                                                    end
                                                    
                                                    function tmp = code(s, u)
                                                    	tmp = (single(3.0) * s) * (u + single(-0.28768208622932434));
                                                    end
                                                    
                                                    \left(3 \cdot s\right) \cdot \left(u + -0.28768208622932434\right)
                                                    
                                                    Derivation
                                                    1. Initial program 95.8%

                                                      \[\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.7%

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

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

                                                      Alternative 13: 10.6% accurate, 3.7× speedup?

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

                                                        \[\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 rewrites25.4%

                                                          \[\leadsto \log \left({\left(\left(u - 1\right) \cdot -1.3333333333333333\right)}^{\left(\left(s \cdot 3\right) \cdot -1\right)}\right) \]
                                                        2. Taylor expanded in s around 0

                                                          \[\leadsto \log 1 \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites10.6%

                                                            \[\leadsto \log 1 \]
                                                          2. Add Preprocessing

                                                          Alternative 14: 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.8630462288856506 \cdot s \]
                                                          (FPCore (s u)
                                                            :precision binary32
                                                            :pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
                                                            (* -0.8630462288856506 s))
                                                          float code(float s, float u) {
                                                          	return -0.8630462288856506f * s;
                                                          }
                                                          
                                                          real(4) function code(s, u)
                                                          use fmin_fmax_functions
                                                              real(4), intent (in) :: s
                                                              real(4), intent (in) :: u
                                                              code = (-0.8630462288856506e0) * s
                                                          end function
                                                          
                                                          function code(s, u)
                                                          	return Float32(Float32(-0.8630462288856506) * s)
                                                          end
                                                          
                                                          function tmp = code(s, u)
                                                          	tmp = single(-0.8630462288856506) * s;
                                                          end
                                                          
                                                          -0.8630462288856506 \cdot s
                                                          
                                                          Derivation
                                                          1. Initial program 95.8%

                                                            \[\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 \log \left(\left(u - 1\right) \cdot -1.3333333333333333\right)\right) \cdot s \]
                                                            2. Step-by-step derivation
                                                              1. Applied rewrites96.4%

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

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

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

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

                                                                Alternative 15: 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.8%

                                                                  \[\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.4%

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

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

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

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

                                                                    Reproduce

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