-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for fix() or abs() #83
Comments
I also seem to recall Riley including a |
I thought about that, but it doesn't always work.
To be clear, I'm looking for a function that always rounds towards 0. Not a function that rounds naturally. |
Ah, yeah; if you want "towards 0," that wouldn't work. Adding half and flooring the number is round, not towards 0. An option other than |
Yeah, what you pointed out with sign() is essentially what I was suggesting could be done using abs().
I've also never heard of fix being regularly available, I just googled to see what such a function is usually called, and "fix" is what came up. |
I think the |
Another solution would be to add a tertiary operator (ie. Which would probably be somewhat more complicated to implement, though also more powerful for those developing character sheets. |
Support for abs() was added today: https://app.roll20.net/forum/post/827711/#post-827711 |
* Fix new sheets incorrectly initializing as AI and Transhuman. * Changelog and version. * Add missing translation key. * Fix Effort bug * Str/Dex mod bug * Weapon/attack description field. * Add toggle (default to off) to calculate ship price. * Reinstate drones fix that got lost in the worker split. * Drones support for NPCs. Closes #82. * Add NPC Shock damage. Closes #83. * Fix NPC attack display wrong range.
In GURPS you should be able to "spend" negative values of points to reduce your stats. However, since floor() always rounds to the lower number, the calculation gets messed up.
For example, if the stat has a base value of 10, and costs 20 points the raise/lower. I'd use a formula like this.
For positive values this works fine, but for most negative values the output is 1 lower than it should be.
Could you implement a fix() function, which always rounds the value towards 0.
Or alternatively add an absolute value function. In which case I could emulate fix() like so:
The text was updated successfully, but these errors were encountered: