
(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 17 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
(cast
(!
:precision
binary64
(/
(exp (/ sinTheta_i (/ v (- sinTheta_O))))
(/ (* v (* (sinh (/ 1.0 v)) 2.0)) (/ cosTheta_i (/ v cosTheta_O)))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
double tmp = exp((((double) sinTheta_i) / (((double) v) / -((double) sinTheta_O)))) / ((((double) v) * (sinh((1.0 / ((double) v))) * 2.0)) / (((double) cosTheta_i) / (((double) v) / ((double) cosTheta_O))));
return (float) 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(8) :: tmp
tmp = exp((real(sintheta_i, 8) / (real(v, 8) / -real(sintheta_o, 8)))) / ((real(v, 8) * (sinh((1.0d0 / real(v, 8))) * 2.0d0)) / (real(costheta_i, 8) / (real(v, 8) / real(costheta_o, 8))))
code = real(tmp, 4)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = Float64(exp(Float64(Float64(sinTheta_i) / Float64(Float64(v) / Float64(-Float64(sinTheta_O))))) / Float64(Float64(Float64(v) * Float64(sinh(Float64(1.0 / Float64(v))) * 2.0)) / Float64(Float64(cosTheta_i) / Float64(Float64(v) / Float64(cosTheta_O))))) return Float32(tmp) end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = exp((double(sinTheta_i) / (double(v) / -sinTheta_O))) / ((double(v) * (sinh((1.0 / double(v))) * 2.0)) / (double(cosTheta_i) / (double(v) / double(cosTheta_O)))); tmp_2 = single(tmp); end
\begin{array}{l}
\\
\langle \left( \frac{e^{\frac{sinTheta_i}{\frac{v}{-sinTheta_O}}}}{\frac{v \cdot \left(\sinh \left(\frac{1}{v}\right) \cdot 2\right)}{\frac{cosTheta_i}{\frac{v}{cosTheta_O}}}} \right)_{\text{binary64}} \rangle_{\text{binary32}}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (/ (* cosTheta_i cosTheta_O) (* v (exp (/ (* sinTheta_i sinTheta_O) v)))) (* v (* 2.0 (cast (! :precision binary64 (sinh (/ 1.0 v))))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
double tmp = sinh((1.0 / ((double) v)));
return ((cosTheta_i * cosTheta_O) / (v * expf(((sinTheta_i * sinTheta_O) / v)))) / (v * (2.0f * ((float) 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(8) :: tmp
tmp = sinh((1.0d0 / real(v, 8)))
code = ((costheta_i * costheta_o) / (v * exp(((sintheta_i * sintheta_o) / v)))) / (v * (2.0e0 * real(tmp, 4)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = sinh(Float64(1.0 / Float64(v))) return Float32(Float32(Float32(cosTheta_i * cosTheta_O) / Float32(v * exp(Float32(Float32(sinTheta_i * sinTheta_O) / v)))) / Float32(v * Float32(Float32(2.0) * Float32(tmp)))) end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = sinh((1.0 / double(v))); tmp_2 = ((cosTheta_i * cosTheta_O) / (v * exp(((sinTheta_i * sinTheta_O) / v)))) / (v * single((double(single(2.0)) * single(tmp)))); end
\begin{array}{l}
\\
\frac{\frac{cosTheta_i \cdot cosTheta_O}{v \cdot e^{\frac{sinTheta_i \cdot sinTheta_O}{v}}}}{v \cdot \left(2 \cdot \langle \left( \sinh \left(\frac{1}{v}\right) \right)_{\text{binary64}} \rangle_{\text{binary32}}\right)}
\end{array}
Initial program 98.6%
Simplified98.6%
Taylor expanded in cosTheta_O around 0 98.6%
rewrite-binary32/binary6499.1%
Applied rewrite-once99.1%
Final simplification99.1%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (/ (/ cosTheta_i (/ v cosTheta_O)) (exp (* sinTheta_O (/ sinTheta_i v)))) (* v (* 2.0 (cast (! :precision binary64 (sinh (/ 1.0 v))))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
double tmp = sinh((1.0 / ((double) v)));
return ((cosTheta_i / (v / cosTheta_O)) / expf((sinTheta_O * (sinTheta_i / v)))) / (v * (2.0f * ((float) 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(8) :: tmp
tmp = sinh((1.0d0 / real(v, 8)))
code = ((costheta_i / (v / costheta_o)) / exp((sintheta_o * (sintheta_i / v)))) / (v * (2.0e0 * real(tmp, 4)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = sinh(Float64(1.0 / Float64(v))) return Float32(Float32(Float32(cosTheta_i / Float32(v / cosTheta_O)) / exp(Float32(sinTheta_O * Float32(sinTheta_i / v)))) / Float32(v * Float32(Float32(2.0) * Float32(tmp)))) end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = sinh((1.0 / double(v))); tmp_2 = ((cosTheta_i / (v / cosTheta_O)) / exp((sinTheta_O * (sinTheta_i / v)))) / (v * single((double(single(2.0)) * single(tmp)))); end
\begin{array}{l}
\\
\frac{\frac{\frac{cosTheta_i}{\frac{v}{cosTheta_O}}}{e^{sinTheta_O \cdot \frac{sinTheta_i}{v}}}}{v \cdot \left(2 \cdot \langle \left( \sinh \left(\frac{1}{v}\right) \right)_{\text{binary64}} \rangle_{\text{binary32}}\right)}
\end{array}
Initial program 98.6%
Simplified98.6%
Taylor expanded in cosTheta_O around 0 98.6%
*-commutative98.6%
associate-/r*98.6%
associate-/l*98.6%
associate-*r/98.6%
Simplified98.6%
rewrite-binary32/binary6499.2%
Applied rewrite-once99.2%
Final simplification99.2%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (/ (* cosTheta_O (* cosTheta_i (/ 1.0 v))) (exp (* sinTheta_O (/ sinTheta_i v)))) (* v (* 2.0 (sinh (/ 1.0 v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_O * (cosTheta_i * (1.0f / v))) / expf((sinTheta_O * (sinTheta_i / v)))) / (v * (2.0f * sinhf((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 * (costheta_i * (1.0e0 / v))) / exp((sintheta_o * (sintheta_i / v)))) / (v * (2.0e0 * sinh((1.0e0 / v))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_O * Float32(cosTheta_i * Float32(Float32(1.0) / v))) / exp(Float32(sinTheta_O * Float32(sinTheta_i / v)))) / Float32(v * Float32(Float32(2.0) * sinh(Float32(Float32(1.0) / v))))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_O * (cosTheta_i * (single(1.0) / v))) / exp((sinTheta_O * (sinTheta_i / v)))) / (v * (single(2.0) * sinh((single(1.0) / v)))); end
\begin{array}{l}
\\
\frac{\frac{cosTheta_O \cdot \left(cosTheta_i \cdot \frac{1}{v}\right)}{e^{sinTheta_O \cdot \frac{sinTheta_i}{v}}}}{v \cdot \left(2 \cdot \sinh \left(\frac{1}{v}\right)\right)}
\end{array}
Initial program 98.6%
Simplified98.6%
Taylor expanded in cosTheta_O around 0 98.6%
*-commutative98.6%
associate-/r*98.6%
associate-/l*98.6%
associate-*r/98.6%
Simplified98.6%
associate-/l*98.6%
*-commutative98.6%
div-inv98.9%
Applied egg-rr98.9%
associate-*l*98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (/ (* (* cosTheta_i cosTheta_O) (/ 1.0 v)) (exp (* sinTheta_O (/ sinTheta_i v)))) (* v (* 2.0 (sinh (/ 1.0 v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (((cosTheta_i * cosTheta_O) * (1.0f / v)) / expf((sinTheta_O * (sinTheta_i / v)))) / (v * (2.0f * sinhf((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_i * costheta_o) * (1.0e0 / v)) / exp((sintheta_o * (sintheta_i / v)))) / (v * (2.0e0 * sinh((1.0e0 / v))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(Float32(cosTheta_i * cosTheta_O) * Float32(Float32(1.0) / v)) / exp(Float32(sinTheta_O * Float32(sinTheta_i / v)))) / Float32(v * Float32(Float32(2.0) * sinh(Float32(Float32(1.0) / v))))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (((cosTheta_i * cosTheta_O) * (single(1.0) / v)) / exp((sinTheta_O * (sinTheta_i / v)))) / (v * (single(2.0) * sinh((single(1.0) / v)))); end
\begin{array}{l}
\\
\frac{\frac{\left(cosTheta_i \cdot cosTheta_O\right) \cdot \frac{1}{v}}{e^{sinTheta_O \cdot \frac{sinTheta_i}{v}}}}{v \cdot \left(2 \cdot \sinh \left(\frac{1}{v}\right)\right)}
\end{array}
Initial program 98.6%
Simplified98.6%
Taylor expanded in cosTheta_O around 0 98.6%
*-commutative98.6%
associate-/r*98.6%
associate-/l*98.6%
associate-*r/98.6%
Simplified98.6%
associate-/l*98.6%
*-commutative98.6%
div-inv98.9%
*-commutative98.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (/ (* cosTheta_i cosTheta_O) (* v (exp (/ (* sinTheta_i sinTheta_O) v)))) (* v (* 2.0 (sinh (/ 1.0 v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_i * cosTheta_O) / (v * expf(((sinTheta_i * sinTheta_O) / v)))) / (v * (2.0f * sinhf((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_i * costheta_o) / (v * exp(((sintheta_i * sintheta_o) / v)))) / (v * (2.0e0 * sinh((1.0e0 / v))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_i * cosTheta_O) / Float32(v * exp(Float32(Float32(sinTheta_i * sinTheta_O) / v)))) / Float32(v * Float32(Float32(2.0) * sinh(Float32(Float32(1.0) / v))))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_i * cosTheta_O) / (v * exp(((sinTheta_i * sinTheta_O) / v)))) / (v * (single(2.0) * sinh((single(1.0) / v)))); end
\begin{array}{l}
\\
\frac{\frac{cosTheta_i \cdot cosTheta_O}{v \cdot e^{\frac{sinTheta_i \cdot sinTheta_O}{v}}}}{v \cdot \left(2 \cdot \sinh \left(\frac{1}{v}\right)\right)}
\end{array}
Initial program 98.6%
Simplified98.6%
Taylor expanded in cosTheta_O around 0 98.6%
Final simplification98.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (/ (/ cosTheta_i (/ v cosTheta_O)) (exp (* sinTheta_O (/ sinTheta_i v)))) (* v (* 2.0 (sinh (/ 1.0 v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_i / (v / cosTheta_O)) / expf((sinTheta_O * (sinTheta_i / v)))) / (v * (2.0f * sinhf((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_i / (v / costheta_o)) / exp((sintheta_o * (sintheta_i / v)))) / (v * (2.0e0 * sinh((1.0e0 / v))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_i / Float32(v / cosTheta_O)) / exp(Float32(sinTheta_O * Float32(sinTheta_i / v)))) / Float32(v * Float32(Float32(2.0) * sinh(Float32(Float32(1.0) / v))))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_i / (v / cosTheta_O)) / exp((sinTheta_O * (sinTheta_i / v)))) / (v * (single(2.0) * sinh((single(1.0) / v)))); end
\begin{array}{l}
\\
\frac{\frac{\frac{cosTheta_i}{\frac{v}{cosTheta_O}}}{e^{sinTheta_O \cdot \frac{sinTheta_i}{v}}}}{v \cdot \left(2 \cdot \sinh \left(\frac{1}{v}\right)\right)}
\end{array}
Initial program 98.6%
Simplified98.6%
Taylor expanded in cosTheta_O around 0 98.6%
*-commutative98.6%
associate-/r*98.6%
associate-/l*98.6%
associate-*r/98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ (/ 1.0 v) (- (exp (/ 1.0 v)) (exp (/ -1.0 v)))) (* cosTheta_O (/ cosTheta_i v))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((1.0f / v) / (expf((1.0f / v)) - expf((-1.0f / v)))) * (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 = ((1.0e0 / v) / (exp((1.0e0 / v)) - exp(((-1.0e0) / v)))) * (costheta_o * (costheta_i / v))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(Float32(1.0) / v) / Float32(exp(Float32(Float32(1.0) / v)) - exp(Float32(Float32(-1.0) / v)))) * Float32(cosTheta_O * Float32(cosTheta_i / v))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((single(1.0) / v) / (exp((single(1.0) / v)) - exp((single(-1.0) / v)))) * (cosTheta_O * (cosTheta_i / v)); end
\begin{array}{l}
\\
\frac{\frac{1}{v}}{e^{\frac{1}{v}} - e^{\frac{-1}{v}}} \cdot \left(cosTheta_O \cdot \frac{cosTheta_i}{v}\right)
\end{array}
Initial program 98.6%
associate-/l*93.9%
*-commutative93.9%
distribute-neg-frac93.9%
distribute-rgt-neg-out93.9%
associate-/l*93.9%
*-commutative93.9%
*-commutative93.9%
associate-/l*93.9%
Simplified93.9%
associate-/l*93.9%
*-commutative93.9%
associate-*l/93.9%
associate-/l*98.6%
associate-/r/98.6%
frac-times98.5%
*-commutative98.5%
div-inv98.4%
associate-*l*98.7%
*-commutative98.7%
Applied egg-rr98.7%
add-exp-log_binary3263.0%
Applied rewrite-once63.0%
rem-exp-log98.7%
associate-*r/98.8%
*-commutative98.8%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in sinTheta_i around 0 98.3%
associate-/r*98.5%
rec-exp98.5%
distribute-neg-frac98.5%
metadata-eval98.5%
Simplified98.5%
Final simplification98.5%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (* cosTheta_i (/ cosTheta_O v)) (/ (/ 1.0 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_i * (cosTheta_O / v)) * ((1.0f / 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_i * (costheta_o / v)) * ((1.0e0 / 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(cosTheta_i * Float32(cosTheta_O / v)) * Float32(Float32(Float32(1.0) / 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_i * (cosTheta_O / v)) * ((single(1.0) / v) / (exp((single(1.0) / v)) - exp((single(-1.0) / v)))); end
\begin{array}{l}
\\
\left(cosTheta_i \cdot \frac{cosTheta_O}{v}\right) \cdot \frac{\frac{1}{v}}{e^{\frac{1}{v}} - e^{\frac{-1}{v}}}
\end{array}
Initial program 98.6%
associate-/l*93.9%
*-commutative93.9%
distribute-neg-frac93.9%
distribute-rgt-neg-out93.9%
associate-/l*93.9%
*-commutative93.9%
*-commutative93.9%
associate-/l*93.9%
Simplified93.9%
associate-/l*93.9%
*-commutative93.9%
associate-*l/93.9%
associate-/l*98.6%
associate-/r/98.6%
frac-times98.5%
*-commutative98.5%
div-inv98.4%
associate-*l*98.7%
*-commutative98.7%
Applied egg-rr98.7%
Taylor expanded in sinTheta_i around 0 98.3%
associate-/r*98.5%
rec-exp98.5%
distribute-neg-frac98.5%
metadata-eval98.5%
Simplified98.4%
Final simplification98.4%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ cosTheta_O (* v v)) (/ cosTheta_i (- (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 * v)) * (cosTheta_i / (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 * v)) * (costheta_i / (exp((1.0e0 / v)) - exp(((-1.0e0) / v))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(cosTheta_O / Float32(v * v)) * Float32(cosTheta_i / 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 * v)) * (cosTheta_i / (exp((single(1.0) / v)) - exp((single(-1.0) / v)))); end
\begin{array}{l}
\\
\frac{cosTheta_O}{v \cdot v} \cdot \frac{cosTheta_i}{e^{\frac{1}{v}} - e^{\frac{-1}{v}}}
\end{array}
Initial program 98.6%
Simplified98.6%
Taylor expanded in cosTheta_O around 0 98.6%
*-commutative98.6%
associate-/r*98.6%
associate-/l*98.6%
associate-*r/98.6%
Simplified98.6%
Taylor expanded in sinTheta_O around 0 98.4%
times-frac98.4%
unpow298.4%
rec-exp98.4%
distribute-neg-frac98.4%
metadata-eval98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (/ (* cosTheta_i cosTheta_O) (* v (exp (/ (* sinTheta_i sinTheta_O) v)))) (+ 2.0 (/ 0.3333333333333333 (* v v)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return ((cosTheta_i * cosTheta_O) / (v * expf(((sinTheta_i * sinTheta_O) / v)))) / (2.0f + (0.3333333333333333f / (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_i * costheta_o) / (v * exp(((sintheta_i * sintheta_o) / v)))) / (2.0e0 + (0.3333333333333333e0 / (v * v)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(cosTheta_i * cosTheta_O) / Float32(v * exp(Float32(Float32(sinTheta_i * sinTheta_O) / v)))) / Float32(Float32(2.0) + Float32(Float32(0.3333333333333333) / Float32(v * v)))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = ((cosTheta_i * cosTheta_O) / (v * exp(((sinTheta_i * sinTheta_O) / v)))) / (single(2.0) + (single(0.3333333333333333) / (v * v))); end
\begin{array}{l}
\\
\frac{\frac{cosTheta_i \cdot cosTheta_O}{v \cdot e^{\frac{sinTheta_i \cdot sinTheta_O}{v}}}}{2 + \frac{0.3333333333333333}{v \cdot v}}
\end{array}
Initial program 98.6%
Simplified98.6%
Taylor expanded in cosTheta_O around 0 98.6%
Taylor expanded in v around inf 63.0%
associate-*r/63.0%
metadata-eval63.0%
unpow263.0%
Simplified63.0%
Final simplification63.0%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ 1.0 (* (/ v cosTheta_O) (/ 2.0 cosTheta_i))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 1.0f / ((v / cosTheta_O) * (2.0f / cosTheta_i));
}
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 = 1.0e0 / ((v / costheta_o) * (2.0e0 / costheta_i))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(1.0) / Float32(Float32(v / cosTheta_O) * Float32(Float32(2.0) / cosTheta_i))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(1.0) / ((v / cosTheta_O) * (single(2.0) / cosTheta_i)); end
\begin{array}{l}
\\
\frac{1}{\frac{v}{cosTheta_O} \cdot \frac{2}{cosTheta_i}}
\end{array}
Initial program 98.6%
*-commutative98.6%
times-frac98.5%
distribute-neg-frac98.5%
distribute-rgt-neg-out98.5%
associate-*l/98.5%
*-commutative98.5%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in v around inf 57.4%
*-commutative57.4%
associate-/l*57.4%
Simplified57.4%
associate-*r/57.4%
*-commutative57.4%
metadata-eval57.4%
div-inv57.4%
clear-num57.7%
div-inv57.7%
clear-num57.7%
Applied egg-rr57.7%
Final simplification57.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ 1.0 (/ 2.0 (* cosTheta_O (/ cosTheta_i v)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 1.0f / (2.0f / (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 = 1.0e0 / (2.0e0 / (costheta_o * (costheta_i / v)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(1.0) / Float32(Float32(2.0) / Float32(cosTheta_O * Float32(cosTheta_i / v)))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(1.0) / (single(2.0) / (cosTheta_O * (cosTheta_i / v))); end
\begin{array}{l}
\\
\frac{1}{\frac{2}{cosTheta_O \cdot \frac{cosTheta_i}{v}}}
\end{array}
Initial program 98.6%
*-commutative98.6%
times-frac98.5%
distribute-neg-frac98.5%
distribute-rgt-neg-out98.5%
associate-*l/98.5%
*-commutative98.5%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in v around inf 57.4%
*-commutative57.4%
associate-/l*57.4%
Simplified57.4%
*-commutative57.4%
div-inv57.4%
clear-num57.4%
metadata-eval57.4%
div-inv57.4%
clear-num57.7%
associate-*r/57.7%
associate-*l/57.7%
*-commutative57.7%
Applied egg-rr57.7%
Final simplification57.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ cosTheta_i (/ v cosTheta_O)) 0.5))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (cosTheta_i / (v / cosTheta_O)) * 0.5f;
}
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 / (v / costheta_o)) * 0.5e0
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(cosTheta_i / Float32(v / cosTheta_O)) * Float32(0.5)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (cosTheta_i / (v / cosTheta_O)) * single(0.5); end
\begin{array}{l}
\\
\frac{cosTheta_i}{\frac{v}{cosTheta_O}} \cdot 0.5
\end{array}
Initial program 98.6%
*-commutative98.6%
times-frac98.5%
distribute-neg-frac98.5%
distribute-rgt-neg-out98.5%
associate-*l/98.5%
*-commutative98.5%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in v around inf 57.4%
*-commutative57.4%
associate-/l*57.4%
Simplified57.4%
Final simplification57.4%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* 0.5 (/ (* cosTheta_i cosTheta_O) v)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 0.5f * ((cosTheta_i * cosTheta_O) / 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_i * costheta_o) / v)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(0.5) * Float32(Float32(cosTheta_i * cosTheta_O) / v)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.5) * ((cosTheta_i * cosTheta_O) / v); end
\begin{array}{l}
\\
0.5 \cdot \frac{cosTheta_i \cdot cosTheta_O}{v}
\end{array}
Initial program 98.6%
*-commutative98.6%
times-frac98.5%
distribute-neg-frac98.5%
distribute-rgt-neg-out98.5%
associate-*l/98.5%
*-commutative98.5%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in v around inf 57.4%
Final simplification57.4%
(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 * cosTheta_O) * Float32(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}
\\
\left(cosTheta_i \cdot cosTheta_O\right) \cdot \frac{0.5}{v}
\end{array}
Initial program 98.6%
associate-/l*93.9%
*-commutative93.9%
distribute-neg-frac93.9%
distribute-rgt-neg-out93.9%
associate-/l*93.9%
*-commutative93.9%
*-commutative93.9%
associate-/l*93.9%
Simplified93.9%
associate-/l*93.9%
*-commutative93.9%
associate-*l/93.9%
associate-/l*98.6%
associate-/r/98.6%
frac-times98.5%
*-commutative98.5%
div-inv98.4%
associate-*l*98.7%
*-commutative98.7%
Applied egg-rr98.7%
Taylor expanded in v around inf 57.4%
*-commutative57.4%
associate-*r/57.4%
clear-num57.7%
un-div-inv57.7%
Applied egg-rr57.7%
associate-/r/57.4%
*-commutative57.4%
Simplified57.4%
Final simplification57.4%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ 0.5 (/ v (* cosTheta_i cosTheta_O))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 0.5f / (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 / (v / (costheta_i * costheta_o))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(0.5) / Float32(v / Float32(cosTheta_i * cosTheta_O))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.5) / (v / (cosTheta_i * cosTheta_O)); end
\begin{array}{l}
\\
\frac{0.5}{\frac{v}{cosTheta_i \cdot cosTheta_O}}
\end{array}
Initial program 98.6%
*-commutative98.6%
times-frac98.5%
distribute-neg-frac98.5%
distribute-rgt-neg-out98.5%
associate-*l/98.5%
*-commutative98.5%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in v around inf 57.4%
*-commutative57.4%
associate-/l*57.4%
Simplified57.4%
clear-num57.7%
un-div-inv57.7%
associate-/l/57.7%
*-commutative57.7%
Applied egg-rr57.7%
Final simplification57.7%
herbie shell --seed 2023297
(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)))