@neauoire i'm cheating -- just using a continued fraction representation:

git.phial.org/d6/modal/src/bra

i had a GCF implementation using the faster fraction from here: en.wikipedia.org/wiki/Generali

however the regular CF provides better approximations, so it seemed better to do it that way.