Difference between revisions of "User:PROXiCiDE/MathUtil"
Jump to navigation
Jump to search
Applied Optimizations by Cipscis
imported>PROXiCiDE m |
imported>PROXiCiDE (Applied Optimizations by Cipscis) |
||
Line 1: | Line 1: | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
;================================================================================= | |||
; Math Functions | |||
; | |||
; Version History | |||
; 0.1 - Initial Release | |||
; 0.2 - Optimizations by Cipscis | |||
; IsNumberEven ,IsNumberOdd ,InRange | |||
;================================================================================= | |||
;================================================================================= | ;================================================================================= | ||
; MinInt() / MinFloat() | ; MinInt() / MinFloat() | ||
Line 50: | Line 59: | ||
;================================================================================= | ;================================================================================= | ||
Bool Function IsNumberEven (Int num) | Bool Function IsNumberEven (Int num) | ||
If Math.Floor(num % 2) | If Math.Floor(num % 2) | ||
Return | Return False | ||
Else | Else | ||
Return | Return True | ||
EndIf | EndIf | ||
EndFunction | EndFunction | ||
Line 62: | Line 71: | ||
; 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 | ; 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 | ||
;================================================================================= | ;================================================================================= | ||
Bool Function | Bool Function IsNumberEven (Int num) | ||
If Math.Floor(num % 2) | If Math.Floor(num % 2) | ||
Return True | Return True | ||
Else | Else | ||
Return False | Return False | ||
EndIf | EndIf | ||
EndFunction | EndFunction | ||
Line 93: | Line 102: | ||
;================================================================================= | ;================================================================================= | ||
Bool Function InRange(Float x,Float min,Float max) | Bool Function InRange(Float x,Float min,Float max) | ||
Return (min <= x && x <= max) | |||
EndFunction | EndFunction | ||
</source> | </source> |