Code archives/Algorithms/Round Floor Celing towards Zero

This code has been declared by its author to be Public Domain code.

Download source code

Round Floor Celing towards Zero by LostCargo2003
Simply trims everything after a decimal. This is a very usefull function for rounding to an integer towards zero.

I dont think this is anything new, but im sure someone might find it usefull when dealing with cartesian tiles
;==========================================================
;FUNCTION ::  MATH FLOOR CEILING
;
;NOTE:  This function trims to the integer. 
;	Simply rounds To the nearest integer in the 
;       direction of zero
;	excellent function for simply trimming th e
;==========================================================
Function MATH_FC#(TARGET_VALUE#)

If  TARGET_VALUE# >0 Then
	Return Floor(TARGET_VALUE#)
End If

If target_value <0 Then
	Return Ceil(TARGET_VALUE#)
End If
	
	

End Function

Comments

None.

Code Archives Forum