in reply to Re: BigFloat Precision
in thread BigFloat Precision

Ok gam3 and eibwen, I took out all the regular math you found and replaced with Math::BigFloats, that must have slipped past me. After a few hours of debugging I'm convinced I'm losing precision in the division that I'm doing. The values in the following equation are all BigFloats and the numerator and an even larger denominator are pretty big. When they divide they should produce a very small number, but instead it looks rounded. Perhaps I'm losing the remainder? So it may just be that I don't know how to interpret the documentation on the bdiv() function and how to get the full fraction value, instead of just the quotient.
Sample Output: numerator: 2187057715053006176499296408615417037129128897214238256113698344404908 +33433694463191774 1033900096370541032981352897479414902891779671690952835880834484674318 +8026.335842416468 8113979341672817820980901270335818142717085694006013286169841932603829 +32770387188042899 0115508942455532934618389216110784616173476066841503276383837003379903 +94156866919077627 9824783435928019360618178076885689415041227681844670764900853378260631 +99991559227379758 3721140943359293289412998382173652701723265352101625829774791587832397 +09014794285875292 6315552361783352460136562979750515887006847684035410231950364818914502 +59071165536628948 2609717574837339905541901751286406418328318293008678171684392671085100 +45199013199185147 5002542698170815681092942517642292616577517786222417104149554986200865 +05926041669295421 7421195236361801616322976530913722541245775661381844217848774307041052 +85817913486193962 1614955079372880536990393780066744832735297424321264402399647634986599 +22373666181492732 7512892111811467257097624814635258985073512630492058901597404864371649 +85151098402011553 402802193447837576587046088366626941267521 denominator: 1500000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000 +00000 c = 77 pi = 0.1 #<-- Rounded or something Revised Code: my $numerator = Math::BigFloat->new($rho)->bpow(Math::BigFloat->new($c +[$i])); my $denominator = Math::BigFloat->new(Factorial($c[$i], \@fact))->bmul +($G); printf("numerator: %s\n", $numerator ); printf("denominator: %s\n", $denominator ); $pi[$i][$c[$i]] = $numerator->copy()->bdiv($denominator); #$pi[$i][$c[$i]] = (Math::BigFloat->new($rho)->bpow(Math::BigFloat->ne +w($c[$i])))->bdiv(Math::BigFloat->new(Factorial($c[$i], \@fact))->bmu +l($G) ); printf("c = $c[$i] pi = $pi[$i][$c[$i]]\n");

Thanx

~bW