ID:90670
 
Not a bug
BYOND Version:462
Operating System:Windows 7 Home Premium
Web Browser:Firefox 3.5.7
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:
Modulo gives division by zero error when not dividing by zero, simple subtraction is returning incorrect values.

Code Snippet (if applicable) to Reproduce Problem:
mob
verb
test()
src << (555.6 - 555) // returns 0.599976
src << (1.1 % 0.1) // division by zero compiler error


Expected Results:
555.6 - 555 = 0.6
1.1 % 0.1 isn't division by zero.
Well I think 0.5999 ~= 6.

I think such minute malfunctions of BYOND math were posted before also.
Modulo isn't meant to work with decimal values; it's meant to work with whole numbers only. Hence 1.1 % 0.1 becomes 1 % 0. Supporting non-integers for this would be nice but it would actually break some games. Workaround: 1.1 - 0.1*round(1.1/0.1). You may want a little fudge factor like +0.0001 inside the round due to the following:

BYOND uses single-precision floating point numbers, which are only accurate to 24 bits. 555.6 is not represented exactly in BYOND's numbering system, because 0.6 is a repeating value in binary. The result you're seeing is normal rounding error. Even with double precision there would be some rounding error present.

It's best to check on the developer forums first before assuming some behavior you didn't expect is a bug. Both of these issues have been discussed there before.