December 04, 2020, 11:46:02 AM

Author Topic: [bb] Round Floor Celing towards Zero by LostCargo [ 1+ years ago ]  (Read 435 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Round Floor Celing  towards Zero
Author : LostCargo
Posted : 1+ years ago

Description : 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


Code :
Code: BlitzBasic
  1. ;==========================================================
  2. ;FUNCTION ::  MATH FLOOR CEILING
  3. ;
  4. ;NOTE:  This function trims to the integer.
  5. ;       Simply rounds To the nearest integer in the
  6. ;       direction of zero
  7. ;       excellent function for simply trimming th e
  8. ;==========================================================
  9. Function MATH_FC#(TARGET_VALUE#)
  10.  
  11. If  TARGET_VALUE# >0 Then
  12.         Return Floor(TARGET_VALUE#)
  13. End If
  14.  
  15. If target_value <0 Then
  16.         Return Ceil(TARGET_VALUE#)
  17. End If
  18.        
  19.        
  20.  
  21. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal