459,256 Members | 1,663 Online Need help? Post your question and get tips & solutions from a community of 459,256 IT Pros & Developers. It's quick & easy.

# Integer and Decimal Parts

 P: n/a Hi. After the prompt reply to my message yeasterday (Problem with Opera an IE), I have another newbie question. How do I separate the integer and decimal part of a number, ie. If I had 123456, and divided it by 1000 = 123.456, how do I obtain 123 and 456 as seperate variables? This is the sort of thing that is done using the "int" and "mod" function in Excel Cheers Si, Jul 20 '05 #1
4 Replies

 P: n/a Si writes: How do I separate the integer and decimal part of a number, ie. If I had 123456, and divided it by 1000 = 123.456, how do I obtain 123 and 456 as seperate variables? This is the sort of thing that is done using the "int" and "mod" function in Excel Just use Math.floor and % (modulus operator). var intPart = Math.floor(123456 / 1000); var fracPart = 123456 % 1000; /L -- Lasse Reichstein Nielsen - lr*@hotpop.com DHTML Death Colors: 'Faith without judgement merely degrades the spirit divine.' Jul 20 '05 #2

 P: n/a Great Thanks! Si, On 01 Nov 2003 19:54:32 +0100, Lasse Reichstein Nielsen wrote: Si writes: How do I separate the integer and decimal part of a number, ie. If I had 123456, and divided it by 1000 = 123.456, how do I obtain 123 and 456 as seperate variables? This is the sort of thing that is done using the "int" and "mod" function in ExcelJust use Math.floor and % (modulus operator). var intPart = Math.floor(123456 / 1000); var fracPart = 123456 % 1000;/L Jul 20 '05 #3

 P: n/a Thats Great! Thanks. Si, On 01 Nov 2003 19:54:32 +0100, Lasse Reichstein Nielsen wrote: Si writes: How do I separate the integer and decimal part of a number, ie. If I had 123456, and divided it by 1000 = 123.456, how do I obtain 123 and 456 as seperate variables? This is the sort of thing that is done using the "int" and "mod" function in ExcelJust use Math.floor and % (modulus operator). var intPart = Math.floor(123456 / 1000); var fracPart = 123456 % 1000;/L Jul 20 '05 #4 