Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account
This post has been closed. You can still view previous posts, but you can't post any new replies.

[[-floor(3/2)]] results in an SyntaxError

1435233590

Edited 1435233615
[[0-floor(3/2)]] works. This is a short post, but it actually reports the bug with all details :)
We don't have a -floor() function. It returns a number so that is why it works with the 0-floor(3/2). I don't believe this is an actual bug per say but I'll see if it is something we can change. Another version that will work would be this: [[floor(3/2)*-1]]. Thanks for the report!
1435258960
The Aaron
Roll20 Production Team
API Scripter
Another alternative that might work for you: [[ceil(-3/2)]] See: <a href="https://wiki.roll20.net/Dice_Reference#Rounding_Ro" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Rounding_Ro</a>...
1435263709
Kryx
Pro
Sheet Author
API Scripter
It actually does work in JavaScript - to my surprise. You can try it in the console: Math.floor(3/2) 1 -Math.floor(3/2) -1
1435264334

Edited 1435264432
The Aaron
Pro
API Scripter
It's a lexer issue in the expression parser. Negation expects the next character to be a number: SyntaxError: Expected [0-9] but "f" found. You get similar results if you attempt double negation: [[--1]] SyntaxError: Expected [0-9] but "-" found. Or a negating parenthetical expression: [[ -(3) ]] SyntaxError: Expected [0-9] but "(" found.
1435276108
Lithl
Pro
Sheet Author
API Scripter
Mark said: It actually does work in JavaScript - to my surprise. You can try it in the console: Math.floor(3/2) 1 -Math.floor(3/2) -1 That's because JavaScript has a more robust expression parser than Roll20 does.