commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (Commented) (JIRA)" <>
Subject [jira] [Commented] (MATH-754) Additional Fraction Constructor
Date Sun, 26 Feb 2012 15:38:48 GMT


Gilles commented on MATH-754:


At first glance, I'm not favorable to this addition. The reason is that IMHO Commons Math
is a library that models mathematical objects and that the preconditions are dictated by the
inherent limitations of those objects (or their numerical implementation). In the case which
you present here, the limitation is imposed by the caller and has nothing to do with the called
code ("Fraction").
One way to deal with your high-level requirement is to create a class that will inherit from
CM "Fraction"; the constructor of your class will thus check the precondition that is now
specific to the object which this new class is meant to model (a fraction with a controlled
set of denominators).

Whether that new class will be a useful addition to the library is another issue.

> Additional Fraction Constructor
> -------------------------------
>                 Key: MATH-754
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: Travis Hanna
>            Priority: Minor
>              Labels: features, newbie, patch
>             Fix For: 3.0
>         Attachments: math.patch
> I'm writing some code which outputs fractional measurements meant for human consumption.
I need a constructor for Fraction which allows you to restrict the denominators to a finite
set. This is necessary due to the fact that real-world tools are only available with certain
fractions. For example, it's next to impossible to find a ruler with 1/7 inch marked :). 
> I'm attaching a patch which implements the functionality. I've attempted to mimic the
style of the existing code as much as possible. One caveat: I don't speak French so the french
error message is a computer-generated translation and probably very poor.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message