Float to Fraction Solution

3 views
Skip to first unread message

Calvin Szeto

unread,
Nov 10, 2011, 11:14:43 PM11/10/11
to atx-sw-m...@googlegroups.com
Hi,

This is regarding the issue that I discussed with Sukant and Lane during the meetup, but it might help anyone else tackling the chemistry balancing program.

To convert a float to a (meaningful) fraction, I found the Python method fractions.Fraction.limit_denominator(). As far as I can tell, it works pretty well; I haven't looked for a Java equivalent but it probably exists. Here is a link to the Python doc: http://docs.python.org/release/3.1.3/library/fractions.html.

That's all!
Calvin Szeto
Reply all
Reply to author
Forward
0 new messages