ghilesZ / geoml

A 2d geometry library for ocaml
GNU Lesser General Public License v2.1
35 stars 5 forks source link

Use function hypot instead of sqrt (dx*.dx+.dy*.dy) #14

Closed richardalligier closed 2 years ago

richardalligier commented 2 years ago

Hello, Since OCaml 4.00, there is the function hypot in the standard library. It is said to avoid undue overflow or underflow. It could be used in Point.distance and Vector.magnitude. In my program, using hypot led me to different (and hopefully more precise) results.

Best, Richard

ghilesZ commented 2 years ago

Hi @richardalligier,

thanks for the remark, i'm pushing a fix right now.

Best, Ghiles.