You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (JIRA)" <ji...@apache.org> on 2019/04/09 23:50:00 UTC
[jira] [Commented] (MATH-1478) Overflow in Vector norm and distance
[ https://issues.apache.org/jira/browse/MATH-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16813913#comment-16813913 ]
Gilles commented on MATH-1478:
------------------------------
Thanks for the report!
However, package {{org.apache.commons.math4.geometry}} is in the process of being ported and refactored into a [new to component|http://commons.apache.org/proper/commons-geometry/].
Could you please report this issue to [its JIRA project|https://issues.apache.org/jira/projects/GEOMETRY]?
A patch/PR to fix the problem [over there|https://gitbox.apache.org/repos/asf?p=commons-geometry.git;a=blob;f=commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/internal/Vectors.java;h=fa5cc8f089984887da36950962d34710ea91c60d;hb=HEAD#l98] is most welcome.
> 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: Major
>
> 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)