Counting digits after the radix point

This is a discussion on Counting digits after the radix point within the C++ Programming forums, part of the General Programming Boards category; For those of you who don't know what a radix point is: In mathematics and computing, a radix point (or ...

  1. #1
    Registered User godly 20's Avatar
    Join Date
    Jan 2011
    Location
    Italy
    Posts
    29

    Thumbs up Counting digits after the radix point

    For those of you who don't know what a radix point is:
    In mathematics and computing, a radix point (or radix character) is the symbol used in numerical representations to separate the integer part of a number (to the left of the radix point) from its fractional part (to the right of the radix point).


    I'm developing a program that converts deciman numbers into fractions and reduces them. Currently its limited to 1 and 2 digit numbers after the radix point. Anyone know an algorithm to count how many digits there are after the radix point?
    "A Computer in every desk and in every home, running Microsoft software."

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Once it's been read in (as a floating point) you're already screwed. If you need to know exactly what the user typed in, read it in as text and count characters. If it's the result of a calculation, then the question is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble counting digits
    By never_lose in forum C Programming
    Replies: 13
    Last Post: 04-27-2011, 11:48 PM
  2. Counting Digits & Numbers
    By yacek in forum C Programming
    Replies: 4
    Last Post: 10-06-2010, 09:44 PM
  3. counting # of digits
    By tidbit in forum C++ Programming
    Replies: 4
    Last Post: 03-25-2010, 03:04 PM
  4. Counting letters and digits
    By FeNCinGeR in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2006, 12:39 PM
  5. Counting integer digits
    By Lionmane in forum C Programming
    Replies: 22
    Last Post: 05-24-2005, 11:11 AM

Tags for this Thread


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