[Xerte] Re: Q for math heads

Tom Reijnders reijnders at tor.nl
Sat Oct 22 18:59:13 BST 2011


If x is the number than the formula is:
Math.floor((x-1)/3) + 1
For 8 this is floor(7/3)+1 = 2+1=3

-- 
Verzonden van mijn Android telefoon met K-9 Mail.

Dave Burnett <d_b_burnett at hotmail.com> wrote:


I know what I want to do and could probably get it to work, but I suspect there is an elegant way to achieve this.

I need to figure out where an index falls in a grid of checkboxes.
ex:

5 questions, 3 possible answers for each question.
Looping through the checkboxes, left to right, top to bottom

1,2,3
4,5,6
7,8,9
10,11,12
13,14,15

What equation do I use to determine which set of answers 8 is in?

I think I would divide by 3, rounding up if there is a remainder?
		 	 		 


This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. 

This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20111022/31f7fd23/attachment.html>


More information about the Xerte mailing list