From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-04-06 12:15:31
Søren Lassen wrote:
> Just a couple of words to introduce myself: I am from Denmark, but
> currently living in Nicaragua, where my wife is employed at the Danish
> embassy. I suppose this means that my current job title is "spouse".
> Before moving, I made a living as a Data Warehouse programmer/analyst.
Good to meet you!
> I have spent some time playing around with the rational.hpp file, and
> have made some improvements. Most important is probably operator<,
> where my new version is completely safe from overflow and (I think)
> considerably faster. Other features are: a member template for converting
> different types of rationals, functions inverse() and power().
> Should I put my version of rational.hpp on the sandbox CVS, or mail
> it to somebody - or is it not relevant at this time?
I think the sandbox vault (http://boost-sandbox.sourceforge.net/vault/) would be
the right place.
> Anyway, considering the call for new features: Maybe the class should
> have a representation of +-infinity and NAN (the latter follows logically
> from the former, because infinity*0->NAN). There may be quite a lot of
> cases where it is not the best solution to throw exceptions for divisions by
> zero, e.g. a spreadsheet or calculator application, where the user
> may do all kinds of funny things - when a division by zero occurs, we just
> want to mark the affected variable as infinite, and write "DIV/0" or
> something similar in the relevant space in the application UI. The
> easiest way to accomplish this is to implement it as a selectable
> feature in the rational class, rather than checking for zero before
> each division, or setting up try...catch blocks around all the
> division operations. Of course, the introduction of NAN rationals
> makes the class only partially ordered (if
> we follow the floating-point standard, where all comparison operations
> involving NAN types return false).
> P.S. Have I posted this reply to the call for features in the right
> way? If not, what is the right way, using Opera for newsgroups and mail?
Yes, you posted correctly.
Thanks for all your suggestions. Right now I'm scrambling to make last minute
changes to the iostreams library before release 1.33. Because of my tardiness
new features for rational will not be introduced until the release following
1.33, but after the release I will carefully consider all the suggestions made
by posters in this thread.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk