plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

ccubrt.c (226B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include "map.h"
      4 
      5 void
      6 ccubrt(double zr, double zi, double *wr, double *wi)
      7 {
      8 	double r, theta;
      9 	theta = atan2(zi,zr);
     10 	r = cubrt(hypot(zr,zi));
     11 	*wr = r*cos(theta/3);
     12 	*wi = r*sin(theta/3);
     13 }