
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* (exp (- (/ (* sinTheta_i sinTheta_O) v))) (/ (* cosTheta_i cosTheta_O) v)) (* (* (sinh (/ 1.0 v)) 2.0) v)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (expf(-((sinTheta_i * sinTheta_O) / v)) * ((cosTheta_i * cosTheta_O) / v)) / ((sinhf((1.0f / v)) * 2.0f) * v);
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = (exp(-((sintheta_i * sintheta_o) / v)) * ((costheta_i * costheta_o) / v)) / ((sinh((1.0e0 / v)) * 2.0e0) * v)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(exp(Float32(-Float32(Float32(sinTheta_i * sinTheta_O) / v))) * Float32(Float32(cosTheta_i * cosTheta_O) / v)) / Float32(Float32(sinh(Float32(Float32(1.0) / v)) * Float32(2.0)) * v)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (exp(-((sinTheta_i * sinTheta_O) / v)) * ((cosTheta_i * cosTheta_O) / v)) / ((sinh((single(1.0) / v)) * single(2.0)) * v); end
\begin{array}{l}
\\
\frac{e^{-\frac{sinTheta\_i \cdot sinTheta\_O}{v}} \cdot \frac{cosTheta\_i \cdot cosTheta\_O}{v}}{\left(\sinh \left(\frac{1}{v}\right) \cdot 2\right) \cdot v}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* (exp (- (/ (* sinTheta_i sinTheta_O) v))) (/ (* cosTheta_i cosTheta_O) v)) (* (* (sinh (/ 1.0 v)) 2.0) v)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (expf(-((sinTheta_i * sinTheta_O) / v)) * ((cosTheta_i * cosTheta_O) / v)) / ((sinhf((1.0f / v)) * 2.0f) * v);
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = (exp(-((sintheta_i * sintheta_o) / v)) * ((costheta_i * costheta_o) / v)) / ((sinh((1.0e0 / v)) * 2.0e0) * v)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(exp(Float32(-Float32(Float32(sinTheta_i * sinTheta_O) / v))) * Float32(Float32(cosTheta_i * cosTheta_O) / v)) / Float32(Float32(sinh(Float32(Float32(1.0) / v)) * Float32(2.0)) * v)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (exp(-((sinTheta_i * sinTheta_O) / v)) * ((cosTheta_i * cosTheta_O) / v)) / ((sinh((single(1.0) / v)) * single(2.0)) * v); end
\begin{array}{l}
\\
\frac{e^{-\frac{sinTheta\_i \cdot sinTheta\_O}{v}} \cdot \frac{cosTheta\_i \cdot cosTheta\_O}{v}}{\left(\sinh \left(\frac{1}{v}\right) \cdot 2\right) \cdot v}
\end{array}
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* (exp (/ (* sinTheta_i sinTheta_O) (- v))) (* (* cosTheta_i cosTheta_O) (/ 1.0 v))) (* v (* (sinh (/ 1.0 v)) 2.0))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (expf(((sinTheta_i * sinTheta_O) / -v)) * ((cosTheta_i * cosTheta_O) * (1.0f / v))) / (v * (sinhf((1.0f / v)) * 2.0f));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = (exp(((sintheta_i * sintheta_o) / -v)) * ((costheta_i * costheta_o) * (1.0e0 / v))) / (v * (sinh((1.0e0 / v)) * 2.0e0))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(exp(Float32(Float32(sinTheta_i * sinTheta_O) / Float32(-v))) * Float32(Float32(cosTheta_i * cosTheta_O) * Float32(Float32(1.0) / v))) / Float32(v * Float32(sinh(Float32(Float32(1.0) / v)) * Float32(2.0)))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (exp(((sinTheta_i * sinTheta_O) / -v)) * ((cosTheta_i * cosTheta_O) * (single(1.0) / v))) / (v * (sinh((single(1.0) / v)) * single(2.0))); end
\begin{array}{l}
\\
\frac{e^{\frac{sinTheta\_i \cdot sinTheta\_O}{-v}} \cdot \left(\left(cosTheta\_i \cdot cosTheta\_O\right) \cdot \frac{1}{v}\right)}{v \cdot \left(\sinh \left(\frac{1}{v}\right) \cdot 2\right)}
\end{array}
Initial program 98.7%
div-inv98.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* (exp (/ (* sinTheta_i sinTheta_O) (- v))) (/ (* cosTheta_i cosTheta_O) v)) (* v (* (sinh (/ 1.0 v)) 2.0))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (expf(((sinTheta_i * sinTheta_O) / -v)) * ((cosTheta_i * cosTheta_O) / v)) / (v * (sinhf((1.0f / v)) * 2.0f));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = (exp(((sintheta_i * sintheta_o) / -v)) * ((costheta_i * costheta_o) / v)) / (v * (sinh((1.0e0 / v)) * 2.0e0))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(exp(Float32(Float32(sinTheta_i * sinTheta_O) / Float32(-v))) * Float32(Float32(cosTheta_i * cosTheta_O) / v)) / Float32(v * Float32(sinh(Float32(Float32(1.0) / v)) * Float32(2.0)))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (exp(((sinTheta_i * sinTheta_O) / -v)) * ((cosTheta_i * cosTheta_O) / v)) / (v * (sinh((single(1.0) / v)) * single(2.0))); end
\begin{array}{l}
\\
\frac{e^{\frac{sinTheta\_i \cdot sinTheta\_O}{-v}} \cdot \frac{cosTheta\_i \cdot cosTheta\_O}{v}}{v \cdot \left(\sinh \left(\frac{1}{v}\right) \cdot 2\right)}
\end{array}
Initial program 98.7%
Final simplification98.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (* 2.0 (/ (/ cosTheta_i v) (- (exp (/ 1.0 v)) (pow E (/ -1.0 v))))) (/ (/ cosTheta_O v) 2.0)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (2.0f * ((cosTheta_i / v) / (expf((1.0f / v)) - powf(((float) M_E), (-1.0f / v))))) * ((cosTheta_O / v) / 2.0f);
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(2.0) * Float32(Float32(cosTheta_i / v) / Float32(exp(Float32(Float32(1.0) / v)) - (Float32(exp(1)) ^ Float32(Float32(-1.0) / v))))) * Float32(Float32(cosTheta_O / v) / Float32(2.0))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (single(2.0) * ((cosTheta_i / v) / (exp((single(1.0) / v)) - (single(2.71828182845904523536) ^ (single(-1.0) / v))))) * ((cosTheta_O / v) / single(2.0)); end
\begin{array}{l}
\\
\left(2 \cdot \frac{\frac{cosTheta\_i}{v}}{e^{\frac{1}{v}} - {e}^{\left(\frac{-1}{v}\right)}}\right) \cdot \frac{\frac{cosTheta\_O}{v}}{2}
\end{array}
Initial program 98.7%
associate-*r/98.7%
associate-/l/98.6%
remove-double-neg98.6%
distribute-rgt-neg-out98.6%
distribute-rgt-neg-out98.6%
distribute-lft-neg-in98.6%
associate-*r/98.6%
associate-/l/98.7%
associate-*r/98.7%
Simplified98.6%
associate-*r*98.6%
associate-*r*98.6%
times-frac98.7%
Applied egg-rr98.6%
Taylor expanded in sinTheta_i around 0 98.6%
associate-/r*98.6%
rec-exp98.6%
distribute-neg-frac98.6%
metadata-eval98.6%
Simplified98.6%
*-un-lft-identity98.6%
exp-prod98.6%
Applied egg-rr98.6%
exp-1-e98.6%
Simplified98.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ (/ cosTheta_O v) 2.0) (* 2.0 (/ (/ cosTheta_i v) (- (exp (/ 1.0 v)) (exp (/ -1.0 v)))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_O / v) / 2.0f) * (2.0f * ((cosTheta_i / v) / (expf((1.0f / v)) - expf((-1.0f / v)))));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = ((costheta_o / v) / 2.0e0) * (2.0e0 * ((costheta_i / v) / (exp((1.0e0 / v)) - exp(((-1.0e0) / v)))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_O / v) / Float32(2.0)) * Float32(Float32(2.0) * Float32(Float32(cosTheta_i / v) / Float32(exp(Float32(Float32(1.0) / v)) - exp(Float32(Float32(-1.0) / v)))))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_O / v) / single(2.0)) * (single(2.0) * ((cosTheta_i / v) / (exp((single(1.0) / v)) - exp((single(-1.0) / v))))); end
\begin{array}{l}
\\
\frac{\frac{cosTheta\_O}{v}}{2} \cdot \left(2 \cdot \frac{\frac{cosTheta\_i}{v}}{e^{\frac{1}{v}} - e^{\frac{-1}{v}}}\right)
\end{array}
Initial program 98.7%
associate-*r/98.7%
associate-/l/98.6%
remove-double-neg98.6%
distribute-rgt-neg-out98.6%
distribute-rgt-neg-out98.6%
distribute-lft-neg-in98.6%
associate-*r/98.6%
associate-/l/98.7%
associate-*r/98.7%
Simplified98.6%
associate-*r*98.6%
associate-*r*98.6%
times-frac98.7%
Applied egg-rr98.6%
Taylor expanded in sinTheta_i around 0 98.6%
associate-/r*98.6%
rec-exp98.6%
distribute-neg-frac98.6%
metadata-eval98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ (/ cosTheta_O v) 2.0) (* 2.0 (/ cosTheta_i (* v (- (exp (/ 1.0 v)) (exp (/ -1.0 v))))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_O / v) / 2.0f) * (2.0f * (cosTheta_i / (v * (expf((1.0f / v)) - expf((-1.0f / v))))));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = ((costheta_o / v) / 2.0e0) * (2.0e0 * (costheta_i / (v * (exp((1.0e0 / v)) - exp(((-1.0e0) / v))))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_O / v) / Float32(2.0)) * Float32(Float32(2.0) * Float32(cosTheta_i / Float32(v * Float32(exp(Float32(Float32(1.0) / v)) - exp(Float32(Float32(-1.0) / v))))))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_O / v) / single(2.0)) * (single(2.0) * (cosTheta_i / (v * (exp((single(1.0) / v)) - exp((single(-1.0) / v)))))); end
\begin{array}{l}
\\
\frac{\frac{cosTheta\_O}{v}}{2} \cdot \left(2 \cdot \frac{cosTheta\_i}{v \cdot \left(e^{\frac{1}{v}} - e^{\frac{-1}{v}}\right)}\right)
\end{array}
Initial program 98.7%
associate-*r/98.7%
associate-/l/98.6%
remove-double-neg98.6%
distribute-rgt-neg-out98.6%
distribute-rgt-neg-out98.6%
distribute-lft-neg-in98.6%
associate-*r/98.6%
associate-/l/98.7%
associate-*r/98.7%
Simplified98.6%
associate-*r*98.6%
associate-*r*98.6%
times-frac98.7%
Applied egg-rr98.6%
Taylor expanded in sinTheta_i around 0 98.6%
associate-/r*98.6%
rec-exp98.6%
distribute-neg-frac98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in cosTheta_i around 0 98.6%
Final simplification98.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(*
(/ (/ cosTheta_O v) 2.0)
(*
2.0
(/
(/ cosTheta_i v)
(+
(exp (/ 1.0 v))
(+ -1.0 (/ (- 1.0 (/ (+ 0.5 (/ -0.16666666666666666 v)) v)) v)))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_O / v) / 2.0f) * (2.0f * ((cosTheta_i / v) / (expf((1.0f / v)) + (-1.0f + ((1.0f - ((0.5f + (-0.16666666666666666f / v)) / v)) / v)))));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = ((costheta_o / v) / 2.0e0) * (2.0e0 * ((costheta_i / v) / (exp((1.0e0 / v)) + ((-1.0e0) + ((1.0e0 - ((0.5e0 + ((-0.16666666666666666e0) / v)) / v)) / v)))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_O / v) / Float32(2.0)) * Float32(Float32(2.0) * Float32(Float32(cosTheta_i / v) / Float32(exp(Float32(Float32(1.0) / v)) + Float32(Float32(-1.0) + Float32(Float32(Float32(1.0) - Float32(Float32(Float32(0.5) + Float32(Float32(-0.16666666666666666) / v)) / v)) / v)))))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_O / v) / single(2.0)) * (single(2.0) * ((cosTheta_i / v) / (exp((single(1.0) / v)) + (single(-1.0) + ((single(1.0) - ((single(0.5) + (single(-0.16666666666666666) / v)) / v)) / v))))); end
\begin{array}{l}
\\
\frac{\frac{cosTheta\_O}{v}}{2} \cdot \left(2 \cdot \frac{\frac{cosTheta\_i}{v}}{e^{\frac{1}{v}} + \left(-1 + \frac{1 - \frac{0.5 + \frac{-0.16666666666666666}{v}}{v}}{v}\right)}\right)
\end{array}
Initial program 98.7%
associate-*r/98.7%
associate-/l/98.6%
remove-double-neg98.6%
distribute-rgt-neg-out98.6%
distribute-rgt-neg-out98.6%
distribute-lft-neg-in98.6%
associate-*r/98.6%
associate-/l/98.7%
associate-*r/98.7%
Simplified98.6%
associate-*r*98.6%
associate-*r*98.6%
times-frac98.7%
Applied egg-rr98.6%
Taylor expanded in sinTheta_i around 0 98.6%
associate-/r*98.6%
rec-exp98.6%
distribute-neg-frac98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in v around -inf 67.0%
mul-1-neg67.0%
unsub-neg67.0%
mul-1-neg67.0%
unsub-neg67.0%
sub-neg67.0%
associate-*r/67.0%
metadata-eval67.0%
distribute-neg-frac67.0%
metadata-eval67.0%
Simplified67.0%
Final simplification67.0%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(let* ((t_0 (/ (/ cosTheta_O v) 2.0)))
(if (<= v 0.43050000071525574)
(*
t_0
(* 2.0 (/ (/ cosTheta_i v) (+ (exp (/ 1.0 v)) (+ (/ 1.0 v) -1.0)))))
(*
t_0
(*
2.0
(/
(/ cosTheta_i v)
(/ (+ 2.0 (/ 0.3333333333333333 (pow v 2.0))) v)))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float t_0 = (cosTheta_O / v) / 2.0f;
float tmp;
if (v <= 0.43050000071525574f) {
tmp = t_0 * (2.0f * ((cosTheta_i / v) / (expf((1.0f / v)) + ((1.0f / v) + -1.0f))));
} else {
tmp = t_0 * (2.0f * ((cosTheta_i / v) / ((2.0f + (0.3333333333333333f / powf(v, 2.0f))) / v)));
}
return tmp;
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
real(4) :: t_0
real(4) :: tmp
t_0 = (costheta_o / v) / 2.0e0
if (v <= 0.43050000071525574e0) then
tmp = t_0 * (2.0e0 * ((costheta_i / v) / (exp((1.0e0 / v)) + ((1.0e0 / v) + (-1.0e0)))))
else
tmp = t_0 * (2.0e0 * ((costheta_i / v) / ((2.0e0 + (0.3333333333333333e0 / (v ** 2.0e0))) / v)))
end if
code = tmp
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = Float32(Float32(cosTheta_O / v) / Float32(2.0)) tmp = Float32(0.0) if (v <= Float32(0.43050000071525574)) tmp = Float32(t_0 * Float32(Float32(2.0) * Float32(Float32(cosTheta_i / v) / Float32(exp(Float32(Float32(1.0) / v)) + Float32(Float32(Float32(1.0) / v) + Float32(-1.0)))))); else tmp = Float32(t_0 * Float32(Float32(2.0) * Float32(Float32(cosTheta_i / v) / Float32(Float32(Float32(2.0) + Float32(Float32(0.3333333333333333) / (v ^ Float32(2.0)))) / v)))); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = (cosTheta_O / v) / single(2.0); tmp = single(0.0); if (v <= single(0.43050000071525574)) tmp = t_0 * (single(2.0) * ((cosTheta_i / v) / (exp((single(1.0) / v)) + ((single(1.0) / v) + single(-1.0))))); else tmp = t_0 * (single(2.0) * ((cosTheta_i / v) / ((single(2.0) + (single(0.3333333333333333) / (v ^ single(2.0)))) / v))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{cosTheta\_O}{v}}{2}\\
\mathbf{if}\;v \leq 0.43050000071525574:\\
\;\;\;\;t\_0 \cdot \left(2 \cdot \frac{\frac{cosTheta\_i}{v}}{e^{\frac{1}{v}} + \left(\frac{1}{v} + -1\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(2 \cdot \frac{\frac{cosTheta\_i}{v}}{\frac{2 + \frac{0.3333333333333333}{{v}^{2}}}{v}}\right)\\
\end{array}
\end{array}
if v < 0.430500001Initial program 98.3%
associate-*r/98.3%
associate-/l/98.1%
remove-double-neg98.1%
distribute-rgt-neg-out98.1%
distribute-rgt-neg-out98.1%
distribute-lft-neg-in98.1%
associate-*r/98.1%
associate-/l/98.3%
associate-*r/98.3%
Simplified98.4%
associate-*r*98.4%
associate-*r*98.4%
times-frac98.3%
Applied egg-rr98.3%
Taylor expanded in sinTheta_i around 0 98.3%
associate-/r*98.4%
rec-exp98.4%
distribute-neg-frac98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in v around inf 68.9%
if 0.430500001 < v Initial program 99.0%
associate-*r/99.0%
associate-/l/99.2%
remove-double-neg99.2%
distribute-rgt-neg-out99.2%
distribute-rgt-neg-out99.2%
distribute-lft-neg-in99.2%
associate-*r/99.2%
associate-/l/99.0%
associate-*r/99.0%
Simplified98.9%
associate-*r*98.9%
associate-*r*98.9%
times-frac99.2%
Applied egg-rr99.0%
Taylor expanded in sinTheta_i around 0 98.9%
associate-/r*98.8%
rec-exp98.8%
distribute-neg-frac98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in v around inf 68.7%
associate-*r/68.7%
metadata-eval68.7%
Simplified68.7%
Final simplification68.8%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ (/ cosTheta_O v) 2.0) (* 2.0 (/ (/ cosTheta_i v) (/ (+ 2.0 (/ 0.3333333333333333 (pow v 2.0))) v)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_O / v) / 2.0f) * (2.0f * ((cosTheta_i / v) / ((2.0f + (0.3333333333333333f / powf(v, 2.0f))) / v)));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = ((costheta_o / v) / 2.0e0) * (2.0e0 * ((costheta_i / v) / ((2.0e0 + (0.3333333333333333e0 / (v ** 2.0e0))) / v)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_O / v) / Float32(2.0)) * Float32(Float32(2.0) * Float32(Float32(cosTheta_i / v) / Float32(Float32(Float32(2.0) + Float32(Float32(0.3333333333333333) / (v ^ Float32(2.0)))) / v)))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_O / v) / single(2.0)) * (single(2.0) * ((cosTheta_i / v) / ((single(2.0) + (single(0.3333333333333333) / (v ^ single(2.0)))) / v))); end
\begin{array}{l}
\\
\frac{\frac{cosTheta\_O}{v}}{2} \cdot \left(2 \cdot \frac{\frac{cosTheta\_i}{v}}{\frac{2 + \frac{0.3333333333333333}{{v}^{2}}}{v}}\right)
\end{array}
Initial program 98.7%
associate-*r/98.7%
associate-/l/98.6%
remove-double-neg98.6%
distribute-rgt-neg-out98.6%
distribute-rgt-neg-out98.6%
distribute-lft-neg-in98.6%
associate-*r/98.6%
associate-/l/98.7%
associate-*r/98.7%
Simplified98.6%
associate-*r*98.6%
associate-*r*98.6%
times-frac98.7%
Applied egg-rr98.6%
Taylor expanded in sinTheta_i around 0 98.6%
associate-/r*98.6%
rec-exp98.6%
distribute-neg-frac98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in v around inf 63.2%
associate-*r/63.2%
metadata-eval63.2%
Simplified63.2%
Final simplification63.2%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ 1.0 (* (/ v cosTheta_i) (/ (fma (* sinTheta_O (/ sinTheta_i v)) 2.0 2.0) cosTheta_O))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 1.0f / ((v / cosTheta_i) * (fmaf((sinTheta_O * (sinTheta_i / v)), 2.0f, 2.0f) / cosTheta_O));
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(1.0) / Float32(Float32(v / cosTheta_i) * Float32(fma(Float32(sinTheta_O * Float32(sinTheta_i / v)), Float32(2.0), Float32(2.0)) / cosTheta_O))) end
\begin{array}{l}
\\
\frac{1}{\frac{v}{cosTheta\_i} \cdot \frac{\mathsf{fma}\left(sinTheta\_O \cdot \frac{sinTheta\_i}{v}, 2, 2\right)}{cosTheta\_O}}
\end{array}
Initial program 98.7%
Simplified98.7%
Taylor expanded in v around inf 57.0%
clear-num57.3%
inv-pow57.3%
+-commutative57.3%
*-commutative57.3%
fma-define57.3%
associate-/l*57.3%
Applied egg-rr57.3%
unpow-157.3%
times-frac57.3%
Simplified57.3%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* 0.5 (/ 1.0 (/ v (* cosTheta_i cosTheta_O)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 0.5f * (1.0f / (v / (cosTheta_i * cosTheta_O)));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = 0.5e0 * (1.0e0 / (v / (costheta_i * costheta_o)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(0.5) * Float32(Float32(1.0) / Float32(v / Float32(cosTheta_i * cosTheta_O)))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.5) * (single(1.0) / (v / (cosTheta_i * cosTheta_O))); end
\begin{array}{l}
\\
0.5 \cdot \frac{1}{\frac{v}{cosTheta\_i \cdot cosTheta\_O}}
\end{array}
Initial program 98.7%
Simplified98.7%
Taylor expanded in v around inf 57.0%
Taylor expanded in v around inf 57.0%
associate-/l*57.0%
Simplified57.0%
Taylor expanded in cosTheta_O around 0 57.0%
*-commutative57.0%
associate-*r/57.0%
Simplified57.0%
associate-*r/57.0%
clear-num57.3%
Applied egg-rr57.3%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* (* cosTheta_i cosTheta_O) -0.5) (- v)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_i * cosTheta_O) * -0.5f) / -v;
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = ((costheta_i * costheta_o) * (-0.5e0)) / -v
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_i * cosTheta_O) * Float32(-0.5)) / Float32(-v)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_i * cosTheta_O) * single(-0.5)) / -v; end
\begin{array}{l}
\\
\frac{\left(cosTheta\_i \cdot cosTheta\_O\right) \cdot -0.5}{-v}
\end{array}
Initial program 98.7%
associate-*r/98.7%
associate-/l/98.6%
remove-double-neg98.6%
distribute-rgt-neg-out98.6%
distribute-rgt-neg-out98.6%
distribute-lft-neg-in98.6%
associate-*r/98.6%
associate-/l/98.7%
associate-*r/98.7%
Simplified98.6%
Taylor expanded in v around -inf 55.6%
Taylor expanded in v around inf 57.0%
Final simplification57.0%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* cosTheta_i (* cosTheta_O 0.5)) v))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (cosTheta_i * (cosTheta_O * 0.5f)) / v;
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = (costheta_i * (costheta_o * 0.5e0)) / v
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(cosTheta_i * Float32(cosTheta_O * Float32(0.5))) / v) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (cosTheta_i * (cosTheta_O * single(0.5))) / v; end
\begin{array}{l}
\\
\frac{cosTheta\_i \cdot \left(cosTheta\_O \cdot 0.5\right)}{v}
\end{array}
Initial program 98.7%
Simplified98.7%
times-frac98.8%
*-commutative98.8%
Applied egg-rr98.8%
Taylor expanded in v around inf 57.0%
associate-*r/57.0%
associate-*r*57.0%
Simplified57.0%
Final simplification57.0%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* 0.5 (* cosTheta_O (/ cosTheta_i v))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 0.5f * (cosTheta_O * (cosTheta_i / v));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = 0.5e0 * (costheta_o * (costheta_i / v))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(0.5) * Float32(cosTheta_O * Float32(cosTheta_i / v))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.5) * (cosTheta_O * (cosTheta_i / v)); end
\begin{array}{l}
\\
0.5 \cdot \left(cosTheta\_O \cdot \frac{cosTheta\_i}{v}\right)
\end{array}
Initial program 98.7%
Simplified98.7%
Taylor expanded in v around inf 57.0%
Taylor expanded in v around inf 57.0%
associate-/l*57.0%
Simplified57.0%
herbie shell --seed 2024103
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:name "HairBSDF, Mp, upper"
:precision binary32
:pre (and (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))) (< 0.1 v)) (<= v 1.5707964))
(/ (* (exp (- (/ (* sinTheta_i sinTheta_O) v))) (/ (* cosTheta_i cosTheta_O) v)) (* (* (sinh (/ 1.0 v)) 2.0) v)))