diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2002-02-11 14:18:22 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2002-02-11 14:18:22 +0000 |
commit | d40714ec5fa54a7555c46250ed328ee358d5e4dc (patch) | |
tree | c5e5a7aeb748cf83e30640878173368e277ac76e | |
parent | 7b80e7df6f2221728f00bbfee7ce3d87d534b2c3 (diff) |
Bug dans 'norm zero'
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4378 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | stdlib/complex.ml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/stdlib/complex.ml b/stdlib/complex.ml index 7c9f20410..05d8910b0 100644 --- a/stdlib/complex.ml +++ b/stdlib/complex.ml @@ -51,7 +51,8 @@ let norm2 x = x.re *. x.re +. x.im *. x.im let norm x = (* Watch out for overflow in computing re^2 + im^2 *) let r = abs_float x.re and i = abs_float x.im in - if r >= i then + if r = 0.0 && i = 0.0 then 0.0 + else if r >= i then let q = i /. r in r *. sqrt(1.0 +. q *. q) else let q = r /. i in i *. sqrt(1.0 +. q *. q) |