----------------------------------- Prince Thu Mar 27, 2003 11:38 am using mod with real values ----------------------------------- unless this just isnt possible, im getting an error saying that assigned value is the wrong type function modX (x, y : real) : int var imod : int imod := x mod y % error given for y result imod end modX is there any way to complete this without changing the variable type? ----------------------------------- Blade Thu Mar 27, 2003 11:41 am ----------------------------------- you cant use real numbers in coordinates or sizes or anything like that, they have to be integers, because you cant use half of a pixel.. ----------------------------------- Tony Thu Mar 27, 2003 12:11 pm ----------------------------------- well mod just tells you if it devides compleatly into the number. so function modReal(num1:real, num2:real):real if (num1/num2) = round(num1/num2) then result 0 else result (num1/num2) - floor(num1/num2) end if end modReal put modReal(10.2, 2.5) the result should be 0.08... code is theoretical as I dont have compiler nearby at the moment... I need someone to confirm that this works ----------------------------------- Blade Thu Mar 27, 2003 12:22 pm ----------------------------------- ah, sorry man, i misunderstood the question.. but yea, tony, i tested it and it works ----------------------------------- Prince Thu Mar 27, 2003 5:10 pm ----------------------------------- thnx tony... it works btw but it still sends out decimal numbers (unless thats wat u wanted it to do) so im gonna try and fix that part ----------------------------------- Tony Thu Mar 27, 2003 6:26 pm ----------------------------------- mod gives you a remainder of the division. modReal acts in the same way as mod, but since both numbers can be real now, so is the remainder.