; Definition file for custom constants and functions
; Names are case insensitive (constants may be case sensitive, see below)


[Constants]
;	Syntax:
;	'name of a constant' = 'its value'
;	append '*' at the end of its name to make it case sensitive
;		e.g. 'kb*', 'kB*'  (but without spaces: 'kB *' - is wrong)

;shortcuts common in binary number system
kb* = *128	; bytes --> kilo bits
kB* = *1024	; bytes --> kilo bytes
MB = *1024*1024		; bytes --> mega bytes
GB = *1024*1024*1024	; bytes --> giga bytes
TB = *1024*1024*1024*1024	; bytes --> terra bytes

; convert mega bytes to bytes
BM = /(1024*1024)
; convert kilo bytes to bytes
BK = /1024
; convert mega bytes to kilo bytes
KM = /1024

;slovak currency: $1 == 39 Sk
$ = 39*

;e
ee = 2.718281828459045

;':' will calculate time, e.g. 2:30 ==> 2*60+30
: = * 60 +	; m:s --> m*60 + s
' = * 60 +	; m's --> m*60 + s

;inch -> cm
'' = *2.54	; x'' --> cm





[Functions]
;	Syntax:
;	'name of a function' = 'expression'
;	'param1', .... 'param8' == function parameters
;	'param_count' == number of parameters
;	use 'paramX(default_value)' to give default value for parameter X (X=1...8)

;example:	avg = (param1 + param2(0) + param3(0) + param4(0) + param5(0) + param6(0) + param7(0) + param8(0)) / nonzero(param_count,1)


;	cubic root
cbrt = param1 pow(1/3)	; cubic root (x ^ (1/3))


:	Fahrenheit <--> Celsius
CelsF = 100/(212-32) * (param1 - 32 )
FahrC = (212-32)/100 * param1 + 32


;	quadratic equation:	param1*x*x + param2*x + param3 = 0
discriminant = param2*param2 - 4*param1*param3
quadratic_eq1 = (-param2 + sqrt(discriminant(param1,param2,param3))) / (2*param1(1))
quadratic_eq2 = (-param2 - sqrt(discriminant(param1,param2,param3))) / (2*param1(1))
quadratic_eq = quadratic_eq1(param1(1),param2,param3)



;	AMD rating calculations
AMDrating = 3 * param1 / 2 - 500	;frequency in MHz 
AMDfreq = 2 * param1 / 3 + 333		;rating

