Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #6030 > unrolled thread
| Started by | Rob Smith <rasmithhalifax@gmail.com> |
|---|---|
| First post | 2013-10-08 04:06 -0700 |
| Last post | 2013-10-08 12:38 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Division Rob Smith <rasmithhalifax@gmail.com> - 2013-10-08 04:06 -0700
Re: Division "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-10-08 13:27 +0200
Re: Division Malcolm G <malcolm-news2012delete@delete.jobstream.com> - 2013-10-08 12:38 +0100
| From | Rob Smith <rasmithhalifax@gmail.com> |
|---|---|
| Date | 2013-10-08 04:06 -0700 |
| Subject | Division |
| Message-ID | <5fe94c71-071f-4775-a89c-ac3a00a5b45e@googlegroups.com> |
Hi I want to divide an integer by another integer and get a result including the full result local nYears as float local nDays as int nYears:=nDays/365 gives me a result of 0 where nDays is 132, how do I divide and get the decimal portion? Thanks Robert
[toc] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2013-10-08 13:27 +0200 |
| Message-ID | <bbi8gfF3jjcU1@mid.individual.net> |
| In reply to | #6030 |
Hi Robert, > I want to divide an integer by another integer and get a result > including the full result > > local nYears as float > local nDays as int > > nYears:=nDays/365 gives me a result of 0 where nDays is 132, how do I > divide and get the decimal portion? try: nYears := float( nDays ) / 365.0 (using 365.0 instead of 365 uses a float instead on an int). The other option is to change the compiler option about integer divisions, but I wouldn't do that. Wolfgang --
[toc] | [prev] | [next] | [standalone]
| From | Malcolm G <malcolm-news2012delete@delete.jobstream.com> |
|---|---|
| Date | 2013-10-08 12:38 +0100 |
| Message-ID | <w8S4u.1$J72.0@fx08.am4> |
| In reply to | #6030 |
On 08/10/2013 12:06, Rob Smith wrote: > Hi > > I want to divide an integer by another integer and get a result including the full result The short answer is don't. That is convert the numbers to float before doing the division. > local nYears as float > local nDays as int > > nYears:=nDays/365 gives me a result of 0 where nDays is 132, how do I divide and get the decimal portion? > > Thanks > > Robert >
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web