Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 47239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:05:29+00:00 2026-05-10T16:05:29+00:00

The .net framework includes Math.IEEERemainder(x, y) in addition to the standard mod operator. What

  • 0

The .net framework includes Math.IEEERemainder(x, y) in addition to the standard mod operator. What is this function really doing? I dont understand the negative numbers that this produces.

Example:

Math.IEEERemainder(0, 2) = 0 Math.IEEERemainder(1, 2) = 1 Math.IEEERemainder(2, 2) = 0 Math.IEEERemainder(3, 2) = -1 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:05:29+00:00Added an answer on May 10, 2026 at 4:05 pm

    If you read the example given at System.Math.IEEERemainder’s MSDN page, you’ll notice that two positive numbers can have a negative remainder.

    Return Value

    A number equal to x – (y Q), where Q is the quotient of x / y rounded to the nearest integer (if x / y falls halfway between two integers, the even integer is returned).

    So: 3 – (2 * (round(3 / 2))) = -1

    /* ... Divide two double-precision floating-point values: 1) The IEEE remainder of 1.797693e+308/2.00 is 0.000000e+000 2) The IEEE remainder of 1.797693e+308/3.00 is -1.000000e+000 Note that two positive numbers can yield a negative remainder.  */ 

    Epilogue

    The actual question could be, "Why do we have two remainder operations?" When dealing with floating point data, you always need to be cognizant of your floating point standard. Since we’re in the 21st century, most everything is on IEEE 754 and very few of us worry about say VAX F_Float versus IEEE 754.

    The C# standard states that the remainder operator (Section 7.7.3), when applied to floating point arguments, is analogous to the remainder operator when applied to integer arguments. That is, the same mathematical formula1 is used (with additional considerations for corner cases associated with floating point representations) in both integer and floating point remainder operations.

    Therefore, if you are looking to have your remainder operations on floating point numbers conform to your current IEEE 754 rounding modes, it is advisable to use Math.IEEERemainder. However, if your usage is not particularly sensitive to the subtle difference in rounding produced by the C# remainder operator, then continue using the operator.

    1. Given: z = x % y, then z = x – (x / y) * y
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

.NET Framework 3.5 comes with all the LINQ goodies, and also includes predefined generic
I've got a iSeries to .Net compact framework project. It includes rgple programs exposed
The .net framework provides in the Math class a method for powering double. But
Is the .NET Framework included in Windows 7? If so, which version?
.NET Framework: 2.0 Preferred Language: C# I am new to TDD (Test Driven Development).
In .NET framework, is it possible to set some of the items in the
Older versions of the .Net Framework used to install Microsoft .NET Framework v1.0 /
In the Full .NET framework you can use the Color.FromArgb() method to create a
After downloading all .NET framework symbols and sources using NetMassDownloader , is it possible
I am working on some documentation and need to reference the .Net Framework Class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.