You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The first issue is that when I am programming I need to multiply two numbers which may either be Real or Integer. But it only gives me the correct result when I put the real number first then the integer.
The second issue is that when doing arithmetic we cannot use brackets.
Code required to reproduce
Error 1:
Take the following example
DECLARE x: INTEGER
DECLARE y: REAL
DECLARE z: REAL
x <- 5
y <- 5.2
z <- x * y
OUTPUT z
This should give the value of 26 since 5 * 5.2 = 26. However it gives an output of -0.2 which is clearly incorrect. However if we invert the variables so that we have z <- y * x we get 26. This means that multiplication only works if you multiply by a real number first followed by an integer. Multiplication should be universal to allow for interchangeability.
Error 2:
Take the following example
DECLARE x: INTEGER
DECLARE y: REAL
DECLARE z: REAL
x <- 5
y <- 5.2
z <- y * x + y
OUTPUT z
This code is correct as it fixes the error from above and gives an output of 31.2. However, adding brackets, z <- (y * x) + y, which should still give 31.2, but gives RuntimeError: Invalid primary type. (INTERNAL ERROR) instead.
Expected behavior
This should not be the case for either as multiplication should be commutative and brackets should be allowed when doing arithmetic.
Desktop (please complete the following information):
OS: MAC
Architecture: 64 Bit
The text was updated successfully, but these errors were encountered:
Describe the bug
The first issue is that when I am programming I need to multiply two numbers which may either be Real or Integer. But it only gives me the correct result when I put the real number first then the integer.
The second issue is that when doing arithmetic we cannot use brackets.
Code required to reproduce
Error 1:
Take the following example
DECLARE x: INTEGER
DECLARE y: REAL
DECLARE z: REAL
x <- 5
y <- 5.2
z <- x * y
OUTPUT z
This should give the value of 26 since 5 * 5.2 = 26. However it gives an output of -0.2 which is clearly incorrect. However if we invert the variables so that we have z <- y * x we get 26. This means that multiplication only works if you multiply by a real number first followed by an integer. Multiplication should be universal to allow for interchangeability.
Error 2:
Take the following example
DECLARE x: INTEGER
DECLARE y: REAL
DECLARE z: REAL
x <- 5
y <- 5.2
z <- y * x + y
OUTPUT z
This code is correct as it fixes the error from above and gives an output of 31.2. However, adding brackets, z <- (y * x) + y, which should still give 31.2, but gives
RuntimeError: Invalid primary type. (INTERNAL ERROR)
instead.Expected behavior
This should not be the case for either as multiplication should be commutative and brackets should be allowed when doing arithmetic.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: