diff --git a/rtl/inc/ucomplex.pp b/rtl/inc/ucomplex.pp index 5aeb87f625..fb5443140f 100644 --- a/rtl/inc/ucomplex.pp +++ b/rtl/inc/ucomplex.pp @@ -408,12 +408,9 @@ Unit UComplex; function cln (z : complex) : complex; { natural logarithm : r := ln(z) } { ln( p exp(i0)) = ln(p) + i0 + 2kpi } - var modz : real; begin - with z do - modz := (re * re) + (im * im); - cln.re := ln(modz); - cln.im := arctan2(z.re, z.im); + cln.re := ln(cmod(z)); + cln.im := arctan2(z.im, z.re); end; function csqrt (z : complex) : complex;