[
https://issues.apache.org/jira/browse/MATH-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Baljit Singh updated MATH-1478:
-------------------------------
Description: In Euclidean Vector classes (Vector2D, Vector3D), getNorm()
and distance() rely on FastMath.sqrt(), which can overflow if the components of
the vectors are large. Instead, they should rely on FastMath.hypot(). For
Vector3D, this would also mean developing FastMath.hypot(double, double,
double), which is equivalent to FastMath.hypot(double, double), but with 3 (or
N) arguments. (was: In Euclidean Vector classes (Vector2D, Vector3D),
getNorm() and distance() rely on FastMath.sqrt(), which can overflow if the
components of the vectors are large. Instead, they should rely on
FastMath.hypot(double, double, double), which is equivalent to
FastMath.hypot(double, double), but with 3 (or N) arguments.)
> Overflow in Vector norm and distance
> ------------------------------------
>
> Key: MATH-1478
> URL: https://issues.apache.org/jira/browse/MATH-1478
> Project: Commons Math
> Issue Type: Improvement
> Affects Versions: 3.6.1
> Reporter: Baljit Singh
> Priority: Minor
>
> In Euclidean Vector classes (Vector2D, Vector3D), getNorm() and distance()
> rely on FastMath.sqrt(), which can overflow if the components of the vectors
> are large. Instead, they should rely on FastMath.hypot(). For Vector3D, this
> would also mean developing FastMath.hypot(double, double, double), which is
> equivalent to FastMath.hypot(double, double), but with 3 (or N) arguments.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)