Vector2int16 corrections

Vector2int16 defines __unm

Vector2int16 defines the __unm operation, which returns a Vector2int16 with the negation of each of its components.

print(-Vector2int16.new(1,2) == Vector2int16.new(-1,-2)) --> true

Vector2int16 allows multiplication by number

Vector2int16 allows multiplication by a number in addition to another Vector2int16.

print(Vector2int16.new(100,100)*Vector2int16.new(2,4) == Vector2int16.new(200,400)) --> true
print(Vector2int16.new(-100,100)*4 == Vector2int16.new(-400,400)) --> true

Vector2int16 allows division by number

Vector2int16 allows division by a number in addition to another Vector2int16.

print(Vector2int16.new(100,100)/Vector2int16.new(2,4) == Vector2int16.new(50,25)) --> true
print(Vector2int16.new(-100,100)/4 == Vector2int16.new(-25,25)) --> true

Vector2int16 division rounding clarification

The results of the division will always be rounded down.

The result of a division rounds towards zero.

print(Vector2int16.new(-100,100)/8 == Vector2int16.new(-13,12)) --> false
print(Vector2int16.new(-100,100)/8 == Vector2int16.new(-12,12)) --> true
2 Likes