I recently started porting a project to Swift for Tensorflow, but while adding support for sampling from a Beta distribution, I bumped into an issue that I'm not sure how to best handle.
I can create a Beta distribution over Float or Double, for example, but when I try to generalize it over
BinaryFloatingPoint, I cannot. The reason is I need to use the
log function when sampling and it's not defined over
BinaryFloatingPoint , but over
Double , and
So, why are floating point operations not generalized over the
BinaryFloatingPoint protocol, and what is a good/standard way to deal with this kind of situation?