Results 1 to 2 of 2

Thread: Converting to int

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2011
    Posts
    40

    Converting to int

    i1 %= f1;
    i1 is a float
    f1 is a double
    i know the mod operator has to be in int.
    so would
    Code:
    (((int)(i1) %= (f1));

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Converting to int

    typecasting i1 to int the way you are doing there makes no sense. What you need to be doing in this case is:

    Code:
    i1 = (int)i1 % (int)f1;
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width