Thread: Decimal places

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    You could scan backwards over your formatted string afterwards and turn zeros back into nulls, and then remove the dot if it then ends in a dot.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  2. #2
    Registered User
    Join Date
    Apr 2007
    Posts
    162
    Quote Originally Posted by iMalc View Post
    You could scan backwards over your formatted string afterwards and turn zeros back into nulls, and then remove the dot if it then ends in a dot.
    Thank you that is a very good idea, I will certainly try to use that

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Isn't there a standard function to check out how many decimal places a float has? If there isn't I'm gonna make one!
    "The Internet treats censorship as damage and routes around it." - John Gilmore

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. %g doesn't print as many decimal places as %f
    By octoc in forum C Programming
    Replies: 1
    Last Post: 03-31-2008, 12:16 PM
  2. Decimal places
    By Gordon in forum Windows Programming
    Replies: 4
    Last Post: 09-28-2007, 10:03 AM
  3. Decimal places on Floating point number
    By manutdfan in forum C Programming
    Replies: 1
    Last Post: 10-29-2006, 12:56 PM
  4. how to set decimal places Borland C++ 3.0 compiler???
    By neo_phyte in forum C++ Programming
    Replies: 10
    Last Post: 08-31-2006, 05:08 PM
  5. Replies: 10
    Last Post: 06-12-2002, 03:15 PM