Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / MOD and floating point values

Author
Message
Mumboz
20
Years of Service
User Offline
Joined: 3rd Aug 2003
Location: Denmark
Posted: 25th Jun 2005 20:59
Hi

I can't get MOD to work on floating point values. Here is my test code:



I suppose this is a bug, but im not really sure.

- Mumboz
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 26th Jun 2005 02:49
I don't know whether this is a bug or not, but mod does appear to accept floats in other languages.


BlueGUI Windows Plugin
Keaz
20
Years of Service
User Offline
Joined: 22nd Sep 2003
Location: Somewhere in south Texas
Posted: 27th Jun 2005 03:37
What does mod do?
Is that the command for remainders?

Breaking Stuff=Fun!,Bug Testing<>Fun!, Bug Testing=Breaking Stuff, so...
Bug Testing=Fun! Hmmmm....
DOES NOT COMPUTE! SYSTEM MALFUNTION!
Mumboz
20
Years of Service
User Offline
Joined: 3rd Aug 2003
Location: Denmark
Posted: 27th Jun 2005 05:05
Yes, remainder of division or something like that.

Eg:
4 mod 3 = 1
11 mod 4 = 3
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 27th Jun 2005 05:26 Edited at: 27th Jun 2005 05:27
yes

[addition] From the help files

Quote: "The MOD specifies that the data on the left side of the MOD is to be divided by the data on the right side of the MOD, and the remainder of the division is the result:


11 MOD 2 equals 1
A MOD B equals the remainder of the division between A and B
"


Dgamer
21
Years of Service
User Offline
Joined: 30th Sep 2002
Location:
Posted: 30th Jun 2005 23:28
Quote: " What does mod do?
Is that the command for remainders?"


Yes, mod is short for modulus. Sometimes represented by %.

This sig has been dullified!
griffirr
19
Years of Service
User Offline
Joined: 27th Apr 2004
Location:
Posted: 1st Jul 2005 07:29 Edited at: 1st Jul 2005 07:41
Quote: "I don't know whether this is a bug or not, but mod does appear to accept floats in other languages."


From the Visual Basic help file

The modulus, or remainder, operator divides number1 by number2 (rounding floating-point numbers to integers) and returns only the remainder as result. For example, in the following expression, A (result) equals 5.

A = 19 Mod 6.7

Usually, the data type of result is a Byte, Byte variant,Integer, Integer variant,Long, or Variant containing a Long, regardless of whether or not result is a whole number.
Mumboz
20
Years of Service
User Offline
Joined: 3rd Aug 2003
Location: Denmark
Posted: 1st Jul 2005 09:18
I see no reason why it can't work with real numbers. Windows Calculator can do that

Here is some random Google-ing from MSDN:

Quote: "Modulus Operator (%)
Divides the value of one expression by the value of another, and returns the remainder.

result = number1 % number2
Arguments
result
Any variable.
number1
Any numeric expression.
number2
Any numeric expression.
Remarks
The modulus, or remainder, operator divides number1 by number2 and returns only the remainder as result. The sign of result is the same as the sign of number1. The value of result is between 0 and the absolute value of number2.

For example, in the following expression, A (which is result) equals 5.6.

A = 19 % 6.7
"


Seems like there are quite different implementations of this
griffirr
19
Years of Service
User Offline
Joined: 27th Apr 2004
Location:
Posted: 2nd Jul 2005 07:39 Edited at: 2nd Jul 2005 07:42
Why not use


Gives the same result as windows calculator for all values and signs

Login to post a reply

Server time is: 2024-04-26 05:06:51
Your offset time is: 2024-04-26 05:06:51