Decimal places on Floating point number

This is a discussion on Decimal places on Floating point number within the C Programming forums, part of the General Programming Boards category; Is it possible to set the amount of decimal places a floating point number is taken too, as I want ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    60

    Decimal places on Floating point number

    Is it possible to set the amount of decimal places a floating point number is taken too, as I want to print a currency value but the number ends up with 6 decimal places using a floating point number.

    Thanks

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,471
    1. search forum
    2. use "%.2f" format
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Decimal places
    By Gordon in forum Windows Programming
    Replies: 9
    Last Post: 06-08-2008, 09:04 AM
  2. How accurate is the following...
    By emeyer in forum C Programming
    Replies: 22
    Last Post: 12-07-2005, 11:07 AM
  3. floating point operators
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 10-22-2003, 07:53 PM
  4. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-25-2001, 11:45 PM
  5. Replies: 2
    Last Post: 09-10-2001, 12:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21