[ 
https://issues.apache.org/jira/browse/LANG-1601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17183777#comment-17183777
 ] 

Jin Xu edited comment on LANG-1601 at 8/25/20, 7:27 AM:
--------------------------------------------------------

[~erans]
Hi.
I checked commons-number's class Fraction's function pow.
It looks good, and seems can be ported to commons-lang after several changes.
But it also differs slightly in some ways.
1. if exponent == 1, then the pow in commons-lang MUST return the original 
Fraction Object itself, but MUST NOT return a new created Fraction.
2. if exponent == -1, then the pow in commons-lang MUST return the reversed 
Fraction Object, but cannot do reduce.
3. otherwise MUST reduce

for example, (6/10 , -1) MUST return 10/6 , but MUST NOT return 5/3

However, it really helps, as I get some new ideas about how do a deeper refine.
will commit soon.


was (Author: xenoamess):
[~erans]
Hi.
I checked commons-number's class Fraction's function pow.
It looks good, and seems can be ported to commons-lang after several changes.
But it also differs slightly in some ways.
1. if exponent == 1, then the pow in commons-lang MUST return the original 
Fraction Object itself, but MUST NOT return a new created Fraction.
2. if exponent == -1, then the pow in commons-lang MUST return the reversed 
Fraction Object, but cannot do trim.
for example, (6/10 , -1) MUST return 10/6 , but MUST NOT return 5/3

However, it really helps, as I get some new ideas about how do a deeper refine.
will commit soon.

> refine performance of Fraction.pow
> ----------------------------------
>
>                 Key: LANG-1601
>                 URL: https://issues.apache.org/jira/browse/LANG-1601
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.math.*
>            Reporter: Jin Xu
>            Priority: Minor
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> https://github.com/apache/commons-lang/pull/611



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to