udfFix
udfVBFix
int udfFix (flt)
int udfVBFix (flt)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfFix (fltNum)
If fltNum > 0 Then Return Int (Floor (fltNum))
Return Int (Ceiling (fltNum))
;..........................................................................................................................................
; This UDF "udfFix" works like the Visual Basic function Fix().
; Input parameter is a float value, which will be rounded to the next integer, symmetrical to zero.
;
; (c)Detlev Dalitz.20110219.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfVBFix (fltNum)
objVBS = ObjectCreate ("MSScriptControl.ScriptControl")
objVBS.Language = "VBScript"
objVBS.AllowUI = @FALSE
intNum = objVBS.Eval(: 'Fix(' : fltNum : ')')
objVBS = 0
Return Int (intNum)
;..........................................................................................................................................
; Input parameter is a float value, which will be rounded to the next integer, symmetrical to zero.
;
; (c)Detlev Dalitz.20110219.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

fltNum11 = +3.2
fltNum12 = -3.2

fltNum21 = +3.5
fltNum22 = -3.5

fltNum31 = +3.8
fltNum32 = -3.8

intNum111 = udfFix (fltNum11) ; +3
intNum112 = udfFix (fltNum12) ; -3

intNum121 = udfFix (fltNum21) ; +3
intNum122 = udfFix (fltNum22) ; -3

intNum131 = udfFix (fltNum31) ; +3
intNum132 = udfFix (fltNum32) ; -3


intNum211 = udfVBFix (fltNum11) ; +3
intNum212 = udfVBFix (fltNum12) ; -3

intNum221 = udfVBFix (fltNum21) ; +3
intNum222 = udfVBFix (fltNum22) ; -3

intNum231 = udfVBFix (fltNum31) ; +3
intNum232 = udfVBFix (fltNum32) ; -3

Exit