changed unsigned long to double for better precision