Fractions

BlitzMax Forums/Brucey's Modules/Fractions

Brucey(Posted 2009) [#1]
BaH.Rational

A little module to do rational number (fraction) arithmetic.

eg.

1/3 * 1/6 = 1/18

Local third:TRational = Rational(1, 3)
Local sixth:TRational = Rational(1, 6)

Local eighteenth:TRational = third.MultiplyR(sixth)


Currently in SVN. Requires BaH.Boost.

:o)


xlsior(Posted 2009) [#2]
It's not compiling properly on Windows:


Compiling:glue.cpp
c:/code/blitzmax/mod/bah.mod/rational.mod/glue.cpp:27:30: boost/rational.hpp: No such file or directory
c:/code/blitzmax/mod/bah.mod/rational.mod/glue.cpp:32: error: `boost' has not been declared
c:/code/blitzmax/mod/bah.mod/rational.mod/glue.cpp:32: error: expected construct or, destructor, or type conversion before '<' token
c:/code/blitzmax/mod/bah.mod/rational.mod/glue.cpp:33: error: `boost' has not be en declared

(and lots more like that)



I have bah.boost installed (it downloaded through SVN), but it appears it's not getting imported properly?

I show rational.hpp in these two folders:
C:\Code\BlitzMax\mod\bah.mod\boost.mod\src\boost\rational.hpp
C:\Code\BlitzMax\mod\bah.mod\boost.mod\src\boost\math\tools\rational.hpp

(They're different filesizes, though)


Brucey(Posted 2009) [#3]
Fixed.

Usually it's the Mac that complains about that... so I thought it was fine as was - although it had crossed my mind at the time ;-)


... I've even just built it on Linux.. to be sure.