CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

Floating Point Numbers

what are they?
numbers that have a decimal part
  • distance in miles;
  • price;
  • weight;
how do we use them?
declare a variable of either type float or double
  • float - you can trust 6 digits of precision
  • double - increases the precision
  • if you need even more precision, you can use long double
  • avoid comparing with ==