commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MATH-561) Analogous to "normalizeAngle" in "MathUtils"
Date Fri, 22 Apr 2011 09:52:05 GMT
Analogous to "normalizeAngle" in "MathUtils"
--------------------------------------------

                 Key: MATH-561
                 URL: https://issues.apache.org/jira/browse/MATH-561
             Project: Commons Math
          Issue Type: Wish
            Reporter: Gilles
            Assignee: Gilles
            Priority: Minor
             Fix For: 3.0


I'd like to create a "reduce" method in "MathUtils", similar to "normalizeAngle" but more
general:
{code}
/**
 * Reduce to the primary interval {@code [offset offset+period)}.
 *
 * @param a Value to reduce.
 * @param period Period.
 * @param offset Offset.
 */
public static double reduce(double a,
                            double period,
                            double offset) {
    return a - period * FastMath.floor((a - offset) / period);
}
{code}
Thus the "period" parameter the is not fixed to 2&pi;, as is the case in "normalizeAngle".


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message