Divscale: Difference between revisions
Jump to navigation
Jump to search
Created page with "'''mulscale''' <Result> <Factor> <Divisor> <Left Shift> In C terms, this command performs roughly the expression <code><Result> = (<Factor> << <Left Shift>) / <Divisor></code..." |
No edit summary |
||
Line 12: | Line 12: | ||
The main difference is that the calculation uses 64 bits to prevent overflow, while using gamevars for intermediate values would limit it to 31 bits. | The main difference is that the calculation uses 64 bits to prevent overflow, while using gamevars for intermediate values would limit it to 31 bits. | ||
See also [[mulscale]] and [[scalevar]]. | |||
[[Category:EDuke32 specific commands]] | [[Category:EDuke32 specific commands]] | ||
[[Category:Gamevar manipulation]] | [[Category:Gamevar manipulation]] |
Revision as of 12:09, 14 November 2019
mulscale <Result> <Factor> <Divisor> <Left Shift>
In C terms, this command performs roughly the expression <Result> = (<Factor> << <Left Shift>) / <Divisor>
.
In CON terms, it is very similar to the following series of commands:
set <Result> <Factor> shiftl <Result> <Left Shift> div <Result> <Divisor>
Note that despite being used as the last value, the left shift value is in the center of the equation.
The main difference is that the calculation uses 64 bits to prevent overflow, while using gamevars for intermediate values would limit it to 31 bits.