Round off a number?
#1

Is there a function? Or may I say how to make one to round off a number.
For example: if the value of a variable is 23.5, how to round it to 24?

Will this work?

new r1=strfind(altitude, ".", true);
if(strval(r1+1 >5))altitude++;//will change 23.5 to 24 - it it isn't more than 5.. the number will stay the same..
strdel(altitude, r1, 5);// assuming there will not be more that five integers after the decimal
//other stuff...


Am not sure if I am suppose to use strval.. I don't think it will work.. because strval may find the value of the length: r1+1( +1 = number after decimal).. Is there anyother fuction i can use to get the number i want..


That 1 question: How to find info from a file inside a specific folder.. I mean to loop every file in a folder without knowing the files' names?
Reply
#2

floatround(number,roundmethod);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)