updated demo code to consistently use float instead of double