I thought about sharing some of my work in 4DGL done so far even though don't know how helpful is for others. All code uploading related topics I will open will have a [ CODE ] in the title for easy spotting. I encourage others to use this convention as well.

i32xxxx functions are work in progress, sadly I don't have the time to get into them.

Source code:

i32xxxx functions are work in progress, sadly I don't have the time to get into them.

Source code:

HTML Code:

//=========================================================================== // Math - functions for various math stuff //=========================================================================== //=========================================================================== // Functions //=========================================================================== //divides value by amount and rounds the result #IF USING round func round(var value, var amount) return(value/amount + ((value % amount) < (amount / 2))); endfunc; #ENDIF //returns number^power #IF USING pow func pow(var number, var power) var result; var i; if (power == 0) result := 1; else result := number; endif for (i:=1; i ((result+1)^2 - number) we must round up if ((number - result*result) > (result*(result+2)+1 - number)) result++; return(result); endfunc; #ENDIF //gets percentage (from 0 to 100%) of a number (ranging from min to max) #IF USING percentage func percentage(var value, var min, var max) var result; result := 100*(value-min)/(max-min); if (result < 0) result := 0; if (result > 100) result := 100; return(result); endfunc; #ENDIF var Term1[2]; var Term2[2]; //32bit sum function. Result in Term1 #IF USING i32Sum func i32Sum() Term1[0] += Term2[0]; Term1[1] += (Term2[1] + OVF()); endfunc; #ENDIF //32bit substraction function. Result in Term1 #IF USING i32Sub func i32Sub() Term1[0] -= Term2[0]; Term1[1] -= (Term2[1] + OVF()); endfunc; #ENDIF //32bit print function of Term1 #IF USING i32Print func i32Print() endfunc; #ENDIF //=========================================================================== // EOF //===========================================================================

## Comment