
Andy Little wrote:
"Jonathan Turkanis" <technews@kangaroologic.com> wrote:
Would it be kosher for me to grab a bigint class from the Yahoo files section -- say the one by Ronald Garcia and Andrew Lumsdaine -- make sure it is in good shape, and let it be the default template parameter to rational?
Surely int should be the default parameter (if any). Using bigint turns it from a relatively lightweight to a heavyweight type.
The reasons I would make it the default parameter are - it's safer than a limited precision type - I wouldn't have to give it a public name, though it could be accessed as rational<>::int_type. I don't think it would discourage users from using rational<int> where appropriate.
In many uses of rational the values are unlikely to overflow. Some uses are in dividing a circle into degrees, minutes, or seconds, power of dimension in a runtime physical-quantity, Storing imperial lengths eg 1 1/8 " (inch). I would guess that these are the major uses of rational and all have values in quite a small range.
Sounds like a good argument that rational is not completely useless without rounding. Andras?
And of course making bigint the default parameter introduces a dependency, which is at least untidy.
Good point.
BTW why doesnt boost::rational have a 'value_type' member rather than the obscure 'int_type'?
You'd have to ask Paul. I would guess it's mean to reflect the requirements on the template parameter.
Further If the mpl rational (or fraction) becomes part of boost: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?MPL_TODO_List. it would be useful to allow interaction between the compile time and run time types:
I agree. But let's wait a bit. Jonathan