Why illegal use of floating point?

This is a discussion on Why illegal use of floating point? within the C++ Programming forums, part of the General Programming Boards category; Hello, why there is illegal use of floating point?and what can be done to resolve it? Code: #include <iostream.h> int ...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    225

    Why illegal use of floating point?

    Hello,
    why there is illegal use of floating point?and what can be done to resolve it?

    Code:
    #include <iostream.h>
    int main(void)
    {
    long double n=234234243234234,i=1221212121,k;
    k=n%i
    cout<<k ;
    return 0;
    }

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,275
    why there is illegal use of floating point?
    operator&#37; is not defined for floating point types.

    what can be done to resolve it?
    Use fmod() from <cmath>

    Incidentally, <iostream.h> should be <iostream>, and I am guessing that 234234243234234 is too large to be an int literal, but should be made a double literal instead.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    225
    Ok thanks laser..!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. checking for floating point number
    By ssharish2005 in forum C Programming
    Replies: 6
    Last Post: 10-18-2005, 09:14 PM
  2. floating point question
    By Eric Cheong in forum C Programming
    Replies: 8
    Last Post: 09-10-2004, 11:48 PM
  3. strtol with floating point
    By Laserve in forum C Programming
    Replies: 3
    Last Post: 07-26-2004, 07:02 AM
  4. floating point variables in edittext controls
    By dootickle in forum Windows Programming
    Replies: 3
    Last Post: 04-15-2004, 12:15 PM
  5. Floating point operations
    By kjc197 in forum C Programming
    Replies: 5
    Last Post: 02-08-2003, 06:44 AM

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