update code for real/complex numbers