Fixed float cast in D algorithm