using stardard Javascript Math library