Difference between revisions of "User:PROXiCiDE/MathUtil"

Jump to navigation Jump to search
251 bytes added ,  16:19, 10 February 2013
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) == 0 
If Math.Floor(num % 2)
Return True
Return False
Else  
Else
Return False
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 IsNumberOdd (Int num)
Bool Function IsNumberEven (Int num)
If Math.Floor(num % 2) == 1
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)
If min <= x && x <= max
Return (min <= x && x <= max)
Return True
Else
Return False
EndIf
EndFunction
EndFunction
</source>
</source>
Anonymous user

Navigation menu