<HTML><BODY><DIV style='font-family: "Verdana"; font-size: 10pt;'><DIV>
<DIV><TT>> I'm working on a monte-carlo simulation which requires the<BR>> calculation of probability for rather high energy levels, Boltzmann<BR>> probability defined, exp(-u/T). The quantity u/T is occasionally<BR>> very large, and in some cases always large. I'd like to use GMP<BR>> rational numbers (mpq_t) to represent the probability and partition<BR>> function of the system.<BR><BR>> I think this is a wrong turn. mpq numbers are fractions, and<BR>> operations on them always give exact results (expending whatever<BR>> effort is necessary to do so). Your numbers aren't representable as<BR>> fractions anyway, so you don't get exact answers no matter what you<BR>> do, so you might as well use mpf (floating-point) numbers instead.<BR>> That'll reduce your execution time quite a lot, I think.<BR></TT></DIV>
<DIV><TT>In good humor, everyone will agree that exp(-300) is not rational. Since "e" is a transcendental constant (i.e. not an algebraic number), it is not a solution to K_1 x^300 = K2. And since e^300 is not rational, neither is e^(-300).</TT></DIV>
<DIV><TT></TT> </DIV>
<DIV><TT>Humor aside ...</TT></DIV>
<DIV><TT></TT> </DIV>
<DIV><TT>One could obtain quite good aribtrary-precision approximations if one would use rational math but limit the maximum size of the numerator and denominator. Then one gets into Farey series, rectangular regions of the integer lattice, and continued fraction algorithms. This can definitely be done. But the question is why anyone would want to do it when arbitrary-precision floating-point math may provide a better abstraction of the numbers one wants to represent.</TT></DIV>
<DIV><TT></TT> </DIV>
<DIV><TT>I agree with Karl. The direction of using rational numbers to represent these quantities doesn't seem very helpful.</TT></DIV>
<DIV><TT></TT> </DIV>
<DIV><TT>BTW, if anyone wants information about Farey series, continued fraction algorithms, and rectangular portions of the integer lattice, just e-mail me at <A href="mailto:dashley@e-collab.com">dashley@e-collab.com</A>.</TT></DIV>
<DIV><TT></TT> </DIV>
<DIV><TT>Dave.</DIV></TT><!-- end of AOLMsgPart_0_76174770-12c3-4406-9e5a-bfea8a11a716 --></DIV></DIV></BODY></HTML>