ID:2749595
 
Not a bug
BYOND Version:514
Operating System:Windows 10 Home
Web Browser:Chrome 96.0.4664.93
Applies to:DM Language
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:

% doesn't work on float number. It either produce a division by zero if the number is < 1 or it just rounds everything up (which is worse, since it's silently failing)

Numbered Steps to Reproduce Problem:

Code Snippet (if applicable) to Reproduce Problem:
world.log << 1.5 % 0.5
world.log << 4 % 1.5
world.log << 3.5 % 1


Expected Results:

0
1
0.5

Actual Results:

Division by zero
0
0

Does the problem occur:
Every time? Or how often? yes
In other games? na
In other user accounts? na
On other computers?na

When does the problem NOT occur? never

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.) no clue

Workarounds:
world.log << 15 % 5
world.log << 40 % 15

</1>
Lummox JR resolved issue (Not a bug)
The % operator only producing integer results is intentional. I'm open to adding a proc in 515 that would handle this properly.
Considering float modulo works in other languages, that would be nice.

C has no native float %, but using fmod works. And at least C raises an error when you try it
I'd prefer % automatically handled floats, but it would break old code, so that's why we need a new proc for it.