WadRayMath
This library provides mul/div[up/down] functionality for WAD, RAY and RAD with phantom overflow protection as well as scale[up/down] functionality for WAD, RAY and RAD.
Functions
wadMulDown
Multiplies two WAD numbers and returns the result as a WAD rounding the result down.
Parameters
Name | Type | Description |
---|---|---|
|
| Multiplicand. |
|
| Multiplier. |
wadMulUp
Multiplies two WAD numbers and returns the result as a WAD rounding the result up.
Parameters
Name | Type | Description |
---|---|---|
|
| Multiplicand. |
|
| Multiplier. |
wadDivDown
Divides two WAD numbers and returns the result as a WAD rounding the result down.
Parameters
Name | Type | Description |
---|---|---|
|
| Dividend. |
|
| Divisor. |
wadDivUp
Divides two WAD numbers and returns the result as a WAD rounding the result up.
Parameters
Name | Type | Description |
---|---|---|
|
| Dividend. |
|
| Divisor. |
rayMulDown
Multiplies two RAY numbers and returns the result as a RAY rounding the result down.
Parameters
Name | Type | Description |
---|---|---|
|
| Multiplicand |
|
| Multiplier |
rayMulUp
Multiplies two RAY numbers and returns the result as a RAY rounding the result up.
Parameters
Name | Type | Description |
---|---|---|
|
| Multiplicand |
|
| Multiplier |
rayDivDown
Divides two RAY numbers and returns the result as a RAY rounding the result down.
Parameters
Name | Type | Description |
---|---|---|
|
| Dividend |
|
| Divisor |
rayDivUp
Divides two RAY numbers and returns the result as a RAY rounding the result up.
Parameters
Name | Type | Description |
---|---|---|
|
| Dividend |
|
| Divisor |
radMulDown
Multiplies two RAD numbers and returns the result as a RAD rounding the result down.
Parameters
Name | Type | Description |
---|---|---|
|
| Multiplicand |
|
| Multiplier |
radMulUp
Multiplies two RAD numbers and returns the result as a RAD rounding the result up.
Parameters
Name | Type | Description |
---|---|---|
|
| Multiplicand |
|
| Multiplier |
radDivDown
Divides two RAD numbers and returns the result as a RAD rounding the result down.
Parameters
Name | Type | Description |
---|---|---|
|
| Dividend |
|
| Divisor |
radDivUp
Divides two RAD numbers and returns the result as a RAD rounding the result up.
Parameters
Name | Type | Description |
---|---|---|
|
| Dividend |
|
| Divisor |
scaleUpToWad
Scales a value up from WAD. NOTE: The scale
value must be less than 18.
Parameters
Name | Type | Description |
---|---|---|
|
| to scale up. |
|
| of the returned value. |
scaleUpToRay
Scales a value up from RAY. NOTE: The scale
value must be less than 27.
Parameters
Name | Type | Description |
---|---|---|
|
| to scale up. |
|
| of the returned value. |
scaleUpToRad
Scales a value up from RAD. NOTE: The scale
value must be less than 45.
Parameters
Name | Type | Description |
---|---|---|
|
| to scale up. |
|
| of the returned value. |
scaleDownToWad
Scales a value down to WAD. NOTE: The scale
value must be greater than 18.
Parameters
Name | Type | Description |
---|---|---|
|
| to scale down. |
|
| of the returned value. |
scaleDownToRay
Scales a value down to RAY. NOTE: The scale
value must be greater than 27.
Parameters
Name | Type | Description |
---|---|---|
|
| to scale down. |
|
| of the returned value. |
scaleDownToRad
Scales a value down to RAD. NOTE: The scale
value must be greater than 45.
Parameters
Name | Type | Description |
---|---|---|
|
| to scale down. |
|
| of the returned value. |
scaleUp
Scales a value up from one fixed-point precision to another.
Parameters
Name | Type | Description |
---|---|---|
|
| to scale up. |
|
| Precision to scale from. |
|
| Precision to scale to. |
scaleDown
Scales a value down from one fixed-point precision to another.
Parameters
Name | Type | Description |
---|---|---|
|
| to scale down. |
|
| Precision to scale from. |
|
| Precision to scale to. |