[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] Issue Comment Edited: (MATH-181) Specify the maximum of
From:       "Luc Maisonobe (JIRA)" <jira () apache ! org>
Date:       2008-01-31 22:41:08
Message-ID: 8508651.1201819268522.JavaMail.jira () brutus
[Download RAW message or body]


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

luc edited comment on MATH-181 at 1/31/08 2:39 PM:
-------------------------------------------------------------

I have checked the ideas I had about denominator. They do not address your issue, so \
the patch as applied is good.

However, I noticed the last statement in the private constructor was a call to \
reduce. This seems strange to me because a known property of the recursive algorithm \
to build the convergents cn=pn/qn is that they are already reduced. This is a result \
of applying the Bezout theorem to the easily proved recursive property p(n)q(n-1) - \
p(n-1)q(n) = (-1)^(n+1). This property holds even if a1 is completely wrong due to \
numerical errors.

When I remove this statement, the existing test succeed as expected. I did not find \
any related information in the log message nor in JIRA.

May I remove this statement or did I miss something ?

      was (Author: luc):
    I have checked the ideas I had about denominator. They are do not address your \
issue, so the patch as applied is good.

However, I noticed the last statement in the private constructor was a call to \
reduce. This seems strange to me because a known property of the recursive algorithm \
to build the convergents cn=pn/qn is that they are already reduced. This is a result \
of applying the Bezout theorem to the easily proved recursive property p(n)q(n-1) - \
p(n-1)q(n) = (-1)^(n+1). This property holds even if a1 is completely wrong due to \
numerical errors.

When I remove this statement, the existing test succeed as expected. I did not find \
any related information in the log message nor in JIRA.

May I remove this statement or did I miss something ?
  
> 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-v2.patch, \
> MATH-181-FractionDigitsLimit.patch, MATH-181-FractionMaxDenominator.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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic