Results 1 to 8 of 8

Thread: Can r = n-Int(n/2)*2 be a Negative number?

Threaded View

  1. #1

    Thread Starter
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Can r = n-Int(n/2)*2 be a Negative number?

    In VB6 or VBA, have you ever seen this formula

    r = n - Int(n / 2) * 2

    gives you the value of r as a negative number such as -1?

    You may know that if n is Integer or Long, the above formula equivalent with

    r = n Mod 2
    Last edited by anhn; Feb 28th, 2008 at 04:31 AM.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

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