[
https://issues.apache.org/jira/browse/NUMBERS-132?focusedWorklogId=280007&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-280007
]
ASF GitHub Bot logged work on NUMBERS-132:
------------------------------------------
Author: ASF GitHub Bot
Created on: 20/Jul/19 00:06
Start Date: 20/Jul/19 00:06
Worklog Time Spent: 10m
Work Description: coveralls commented on issue #67: NUMBERS-132: Perform
gcd algorithm on negative numbers in ArithmeticUtils.gcd(int, int)
URL: https://github.com/apache/commons-numbers/pull/67#issuecomment-513415934
[](https://coveralls.io/builds/24688583)
Coverage increased (+0.05%) to 94.3% when pulling
**c704066797e41d117c3e0723d71d8e98b394e78a on Schamschi:NUMBERS-132** into
**3eb540507a559b4c37a802c489b8c9218cf6bc9c on apache:master**.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 280007)
Time Spent: 20m (was: 10m)
> ArithmeticUtils.gcd(int, int) can be simplified by performing the gcd
> algorithm on negative numbers
> ---------------------------------------------------------------------------------------------------
>
> Key: NUMBERS-132
> URL: https://issues.apache.org/jira/browse/NUMBERS-132
> Project: Commons Numbers
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.0
> Reporter: Heinrich Bohne
> Priority: Minor
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The method {{ArithmeticUtils.gcd(int, int)}} currently handles the special
> case of the non-negatable {{Integer.MIN_VALUE}} by converting the arguments
> to {{long}}s if one of them is {{Integer.MIN_VALUE}} and performing two
> iterations of the regular euclidean algorithm before handing the resulting
> values over to a helper method that performs the binary gcd algorithm.
> However, the tactic used by {{gcd(long, long)}} is much more elegant: It just
> converts positive arguments to their negative counterparts, thereby avoiding
> the risk of overflow completely without having to make exceptions for special
> cases and resorting to other data types.
> The method {{gcd(int, int)}} would likely be much more compact if it also
> were to apply this technique.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)