[ 
https://issues.apache.org/jira/browse/MATH-181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562019#action_12562019
 ] 

Niall Pemberton commented on MATH-181:
--------------------------------------

Yes, I mostly just copied the existing constructor and didn't put any effort - 
sorry :(

Its an either or situation and not optimal (which is why I made it private) - 
but it means that with a couple of slight modifications the same code can be 
(re)used either with an epsilon or specified max. denominator digits. I can 
either submit another patch with improved JavaDoc or spearate out the two 
cases, duplicating the double-->fraction code. Which would you prefer?

> Specify the maximum of digits when parsing a Fraction
> -----------------------------------------------------
>
>                 Key: MATH-181
>                 URL: https://issues.apache.org/jira/browse/MATH-181
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Niall Pemberton
>            Priority: Minor
>         Attachments: MATH-181-FractionDigitsLimit.patch
>
>
> Firstly, thanks for the Fraction code - I've adapated it for something I'm 
> working on and I didn't have a clue how to convert a decimal to a fraction :)
> Excel spreadsheets have the facility to specify a fraction format where you 
> specify the maximum number of denominator digits to display.
> So for example:
>     format "?/?" displays decimal values formatted in the range 1/2 to n/9
>     format "??/??" displays decimal values formatted in the range 1/2 to n/99
>     format "???/???" displays decimal values formatted in the range 1/2 to 
> n/999 etc
> In excel then the value 0.6152 displays as 3/5, 8/13 and 510/829 respectively 
> for the above 3 formats.
> I'm attaching a patch for the Fraction class which adds a new constructor 
> where the maximum number of digits can be specified, rather than the epsilon 
> value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to