fmod %

This is a discussion on fmod % within the C Programming forums, part of the General Programming Boards category; So I heard you can't use the modulus operator with floats. You need to use fmod. So my question is, ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129

    fmod %

    So I heard you can't use the modulus operator with floats. You need to use fmod. So my question is, why didn't they just make the operator do that? Is there some technical reason behind it or something?

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,308
    Perhaps because mod is usually the remainder after division, but in floating point there never is any remainder with division.
    Or maybe you'd just have to ask the language inventors.
    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"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FMOD implimentation, how'd you do it?
    By Jeremy G in forum Game Programming
    Replies: 10
    Last Post: 06-12-2004, 01:04 AM
  2. compiling a simple Fmod program
    By lambs4 in forum Game Programming
    Replies: 2
    Last Post: 04-27-2004, 01:11 PM
  3. Does fmod only support 3D sound with .wave?
    By Silvercord in forum Game Programming
    Replies: 3
    Last Post: 04-04-2004, 08:03 PM
  4. error with fmod() function
    By minesweeper in forum C++ Programming
    Replies: 3
    Last Post: 08-30-2003, 06:24 AM
  5. Fmod and windows programming
    By AtomRiot in forum Windows Programming
    Replies: 1
    Last Post: 01-06-2003, 03:13 PM

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