Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Numbers/standard_complex_numbers_polar.adb, Revision 1.1
1.1 ! maekawa 1: with Standard_Mathematical_Functions; use Standard_Mathematical_Functions;
! 2:
! 3: package body Standard_Complex_Numbers_Polar is
! 4:
! 5: function Radius ( c : Complex_Number ) return double_float is
! 6: begin
! 7: return SQRT(REAL_PART(c)**2 + IMAG_PArt(c)**2);
! 8: end Radius;
! 9:
! 10: function Angle ( c : Complex_Number ) return double_float is
! 11: begin
! 12: return Standard_Mathematical_Functions.Angle(IMAG_PART(c),REAL_PART(c));
! 13: end Angle;
! 14:
! 15: function Root ( c : Complex_Number; n,i : natural ) return Complex_Number is
! 16:
! 17: arg,radius_c,angle_c : double_float;
! 18: tmp : Complex_Number;
! 19:
! 20: begin
! 21: arg := (2.0 * PI * double_float(i)) / double_float(n);
! 22: radius_c := RADIUS(c)**(1.0/double_float(n));
! 23: angle_c := ANGLE(c)/double_float(n);
! 24: tmp := Create(radius_c)*Create(COS(angle_c),SIN(angle_c));
! 25: return Create(COS(arg),SIN(arg))*tmp;
! 26: end Root;
! 27:
! 28: end Standard_Complex_Numbers_Polar;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>