Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Modulus function

Modulus function

Scheduled Pinned Locked Moved C#
csharptutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    usyra42
    wrote on last edited by
    #1

    hi all, How to calculate the Modulus Function in C#.net for example :|3-4|>1 what could be its precedence .

    usharani

    L S T 3 Replies Last reply
    0
    • U usyra42

      hi all, How to calculate the Modulus Function in C#.net for example :|3-4|>1 what could be its precedence .

      usharani

      L Offline
      L Offline
      laserbaronen
      wrote on last edited by
      #2

      % 10%2


      betonglasermur.FeedDwarf(pur_is, 17);
      ProcessStartupInfo.AintNotCreateNoWindow = (false && !true) != (true || false) ? false == true ? true : false : (true != false && false);

      Morgonen är tröttmans mecka

      1 Reply Last reply
      0
      • U usyra42

        hi all, How to calculate the Modulus Function in C#.net for example :|3-4|>1 what could be its precedence .

        usharani

        S Offline
        S Offline
        Shree
        wrote on last edited by
        #3

        Use Math.Abs()

        1 Reply Last reply
        0
        • U usyra42

          hi all, How to calculate the Modulus Function in C#.net for example :|3-4|>1 what could be its precedence .

          usharani

          T Offline
          T Offline
          The Nightcoder
          wrote on last edited by
          #4

          If you really mean what you say - modulus (as in remainder from division), see the post from laserbaronen (% is the modulus operator in C#). If you're doing scientific calculations and you want the IEEE specification of the remainder operation, use Math.IEEERemainder() instead. If you mean the absolute value (as in |-1| = 1, which could be infered from your example), see the post from Shree (Math.Abs does that). The precedence of the modulus operator (%) can be found in the C# reference (which shouldn't be further from you than the F1 key and a couple of mouse clicks). It's in the multiplicative operator group (same precedence as * and /).

          -- Peter

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups