Average Error: 0.1 → 0.1
Time: 17.8s
Precision: binary32
Cost: 26368
\[\left(\left(\left(\left(-1 \leq cosTheta_i \land cosTheta_i \leq 1\right) \land \left(-1 \leq cosTheta_O \land cosTheta_O \leq 1\right)\right) \land \left(-1 \leq sinTheta_i \land sinTheta_i \leq 1\right)\right) \land \left(-1 \leq sinTheta_O \land sinTheta_O \leq 1\right)\right) \land \left(-1.5707964 \leq v \land v \leq 0.1\right)\]
\[e^{\left(\left(\left(\frac{cosTheta_i \cdot cosTheta_O}{v} - \frac{sinTheta_i \cdot sinTheta_O}{v}\right) - \frac{1}{v}\right) + 0.6931\right) + \log \left(\frac{1}{2 \cdot v}\right)} \]
\[\begin{array}{l} t_0 := \sqrt[3]{0.5 \cdot \left(\left(0.6931 + \frac{-1}{v}\right) + \log \left(\frac{0.5}{v}\right)\right)}\\ {\left({\left(e^{{t_0}^{2}}\right)}^{t_0}\right)}^{2} \end{array} \]
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
 :precision binary32
 (exp
  (+
   (+
    (-
     (- (/ (* cosTheta_i cosTheta_O) v) (/ (* sinTheta_i sinTheta_O) v))
     (/ 1.0 v))
    0.6931)
   (log (/ 1.0 (* 2.0 v))))))
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
 :precision binary32
 (let* ((t_0 (cbrt (* 0.5 (+ (+ 0.6931 (/ -1.0 v)) (log (/ 0.5 v)))))))
   (pow (pow (exp (pow t_0 2.0)) t_0) 2.0)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
	return expf(((((((cosTheta_i * cosTheta_O) / v) - ((sinTheta_i * sinTheta_O) / v)) - (1.0f / v)) + 0.6931f) + logf((1.0f / (2.0f * v)))));
}
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
	float t_0 = cbrtf((0.5f * ((0.6931f + (-1.0f / v)) + logf((0.5f / v)))));
	return powf(powf(expf(powf(t_0, 2.0f)), t_0), 2.0f);
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v)
	return exp(Float32(Float32(Float32(Float32(Float32(Float32(cosTheta_i * cosTheta_O) / v) - Float32(Float32(sinTheta_i * sinTheta_O) / v)) - Float32(Float32(1.0) / v)) + Float32(0.6931)) + log(Float32(Float32(1.0) / Float32(Float32(2.0) * v)))))
end
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v)
	t_0 = cbrt(Float32(Float32(0.5) * Float32(Float32(Float32(0.6931) + Float32(Float32(-1.0) / v)) + log(Float32(Float32(0.5) / v)))))
	return (exp((t_0 ^ Float32(2.0))) ^ t_0) ^ Float32(2.0)
end
e^{\left(\left(\left(\frac{cosTheta_i \cdot cosTheta_O}{v} - \frac{sinTheta_i \cdot sinTheta_O}{v}\right) - \frac{1}{v}\right) + 0.6931\right) + \log \left(\frac{1}{2 \cdot v}\right)}
\begin{array}{l}
t_0 := \sqrt[3]{0.5 \cdot \left(\left(0.6931 + \frac{-1}{v}\right) + \log \left(\frac{0.5}{v}\right)\right)}\\
{\left({\left(e^{{t_0}^{2}}\right)}^{t_0}\right)}^{2}
\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[e^{\left(\left(\left(\frac{cosTheta_i \cdot cosTheta_O}{v} - \frac{sinTheta_i \cdot sinTheta_O}{v}\right) - \frac{1}{v}\right) + 0.6931\right) + \log \left(\frac{1}{2 \cdot v}\right)} \]
  2. Simplified0.1

    \[\leadsto \color{blue}{e^{\mathsf{fma}\left(cosTheta_i, \frac{cosTheta_O}{v}, 0.6931\right) - \mathsf{fma}\left(sinTheta_i, \frac{sinTheta_O}{v}, \frac{1}{v}\right)} \cdot \frac{0.5}{v}} \]
    Proof
    (*.f32 (exp.f32 (-.f32 (fma.f32 cosTheta_i (/.f32 cosTheta_O v) 6931/10000) (fma.f32 sinTheta_i (/.f32 sinTheta_O v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (Rewrite<= fma-def_binary32 (+.f32 (*.f32 cosTheta_i (/.f32 cosTheta_O v)) 6931/10000)) (fma.f32 sinTheta_i (/.f32 sinTheta_O v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (+.f32 (Rewrite<= *-commutative_binary32 (*.f32 (/.f32 cosTheta_O v) cosTheta_i)) 6931/10000) (fma.f32 sinTheta_i (/.f32 sinTheta_O v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (+.f32 (Rewrite=> associate-*l/_binary32 (/.f32 (*.f32 cosTheta_O cosTheta_i) v)) 6931/10000) (fma.f32 sinTheta_i (/.f32 sinTheta_O v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (+.f32 (/.f32 (Rewrite<= *-commutative_binary32 (*.f32 cosTheta_i cosTheta_O)) v) 6931/10000) (fma.f32 sinTheta_i (/.f32 sinTheta_O v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (Rewrite<= +-commutative_binary32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v))) (fma.f32 sinTheta_i (/.f32 sinTheta_O v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v)) (fma.f32 sinTheta_i (/.f32 sinTheta_O v) (Rewrite<= remove-double-neg_binary32 (neg.f32 (neg.f32 (/.f32 1 v))))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v)) (Rewrite<= fma-neg_binary32 (-.f32 (*.f32 sinTheta_i (/.f32 sinTheta_O v)) (neg.f32 (/.f32 1 v)))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v)) (-.f32 (Rewrite=> associate-*r/_binary32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (neg.f32 (/.f32 1 v))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (Rewrite<= associate-+r-_binary32 (+.f32 6931/10000 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (-.f32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v) (neg.f32 (/.f32 1 v))))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (+.f32 6931/10000 (Rewrite<= associate-+l-_binary32 (+.f32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (neg.f32 (/.f32 1 v)))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (+.f32 6931/10000 (Rewrite<= sub-neg_binary32 (-.f32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (/.f32 1 v))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (+.f32 6931/10000 (Rewrite=> associate--l-_binary32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (+.f32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v) (/.f32 1 v)))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (Rewrite=> associate-+r-_binary32 (-.f32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v)) (+.f32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v) (/.f32 1 v))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (Rewrite<= +-rgt-identity_binary32 (+.f32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v)) 0)) (+.f32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (+.f32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v)) (Rewrite<= metadata-eval (log.f32 1))) (+.f32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (+.f32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v)) (Rewrite=> metadata-eval 0)) (+.f32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (-.f32 (Rewrite=> +-rgt-identity_binary32 (+.f32 6931/10000 (/.f32 (*.f32 cosTheta_i cosTheta_O) v))) (+.f32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v) (/.f32 1 v)))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (Rewrite<= associate-+r-_binary32 (+.f32 6931/10000 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (+.f32 (/.f32 (*.f32 sinTheta_i sinTheta_O) v) (/.f32 1 v)))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (+.f32 6931/10000 (Rewrite<= associate--l-_binary32 (-.f32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (/.f32 1 v))))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (Rewrite<= +-commutative_binary32 (+.f32 (-.f32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (/.f32 1 v)) 6931/10000))) (/.f32 1/2 v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (+.f32 (-.f32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (/.f32 1 v)) 6931/10000)) (/.f32 (Rewrite<= metadata-eval (/.f32 1 2)) v)): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (+.f32 (-.f32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (/.f32 1 v)) 6931/10000)) (Rewrite<= associate-/r*_binary32 (/.f32 1 (*.f32 2 v)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (exp.f32 (+.f32 (-.f32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (/.f32 1 v)) 6931/10000)) (Rewrite<= rem-exp-log_binary32 (exp.f32 (log.f32 (/.f32 1 (*.f32 2 v)))))): 2 points increase in error, 0 points decrease in error
    (Rewrite<= exp-sum_binary32 (exp.f32 (+.f32 (+.f32 (-.f32 (-.f32 (/.f32 (*.f32 cosTheta_i cosTheta_O) v) (/.f32 (*.f32 sinTheta_i sinTheta_O) v)) (/.f32 1 v)) 6931/10000) (log.f32 (/.f32 1 (*.f32 2 v)))))): 3 points increase in error, 1 points decrease in error
  3. Applied egg-rr0.1

    \[\leadsto \color{blue}{{\left(\sqrt{e^{\mathsf{fma}\left(cosTheta_i, \frac{cosTheta_O}{v}, 0.6931\right) - \mathsf{fma}\left(sinTheta_i, \frac{sinTheta_O}{v}, \frac{1}{v}\right)} \cdot \frac{0.5}{v}}\right)}^{2}} \]
  4. Taylor expanded in sinTheta_i around 0 0.1

    \[\leadsto {\left(\sqrt{\color{blue}{e^{\left(0.6931 + \frac{cosTheta_i \cdot cosTheta_O}{v}\right) - \frac{1}{v}}} \cdot \frac{0.5}{v}}\right)}^{2} \]
  5. Taylor expanded in cosTheta_i around 0 0.1

    \[\leadsto {\left(\sqrt{e^{\color{blue}{0.6931} - \frac{1}{v}} \cdot \frac{0.5}{v}}\right)}^{2} \]
  6. Applied egg-rr0.1

    \[\leadsto {\color{blue}{\left({\left(e^{{\left(\sqrt[3]{0.5 \cdot \left(\left(0.6931 + \frac{-1}{v}\right) + \log \left(\frac{0.5}{v}\right)\right)}\right)}^{2}}\right)}^{\left(\sqrt[3]{0.5 \cdot \left(\left(0.6931 + \frac{-1}{v}\right) + \log \left(\frac{0.5}{v}\right)\right)}\right)}\right)}}^{2} \]
  7. Final simplification0.1

    \[\leadsto {\left({\left(e^{{\left(\sqrt[3]{0.5 \cdot \left(\left(0.6931 + \frac{-1}{v}\right) + \log \left(\frac{0.5}{v}\right)\right)}\right)}^{2}}\right)}^{\left(\sqrt[3]{0.5 \cdot \left(\left(0.6931 + \frac{-1}{v}\right) + \log \left(\frac{0.5}{v}\right)\right)}\right)}\right)}^{2} \]

Alternatives

Alternative 1
Error0.1
Cost9888
\[e^{0.6931 + \left(\log 0.5 + \left(\frac{-1}{v} - \log v\right)\right)} \]
Alternative 2
Error0.1
Cost3488
\[\frac{0.5}{v} \cdot e^{0.6931 + \frac{-1}{v}} \]
Alternative 3
Error0.7
Cost3424
\[\frac{0.5}{v} \cdot e^{\frac{-1}{v}} \]
Alternative 4
Error0.7
Cost3296
\[e^{\frac{-1}{v}} \]
Alternative 5
Error29.0
Cost288
\[sinTheta_i \cdot \left(sinTheta_O \cdot \frac{-0.5}{v \cdot v}\right) \]
Alternative 6
Error27.5
Cost288
\[\left(sinTheta_O \cdot \frac{sinTheta_i}{v}\right) \cdot \frac{-0.5}{v} \]
Alternative 7
Error20.0
Cost288
\[\frac{sinTheta_i \cdot sinTheta_O}{v} \cdot \frac{-0.5}{v} \]
Alternative 8
Error30.5
Cost96
\[\frac{0.5}{v} \]

Error

Reproduce

herbie shell --seed 2022291 
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
  :name "HairBSDF, Mp, lower"
  :precision binary32
  :pre (and (and (and (and (and (<= -1.0 cosTheta_i) (<= cosTheta_i 1.0)) (and (<= -1.0 cosTheta_O) (<= cosTheta_O 1.0))) (and (<= -1.0 sinTheta_i) (<= sinTheta_i 1.0))) (and (<= -1.0 sinTheta_O) (<= sinTheta_O 1.0))) (and (<= -1.5707964 v) (<= v 0.1)))
  (exp (+ (+ (- (- (/ (* cosTheta_i cosTheta_O) v) (/ (* sinTheta_i sinTheta_O) v)) (/ 1.0 v)) 0.6931) (log (/ 1.0 (* 2.0 v))))))