I believe your problem is that though you are creating a bigfloat number, you are doing simple math operations in perl. You should probably be using Math::BigFloat's fdiv and the like for your math. I will point out that your code works for normal perl sized numbers...