For Programmers: Free Programming Magazines  


Home > Archive > Clarion > June 2006 > Whole Number









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Whole Number
Kent Baldwin

2006-06-24, 7:55 am

I need to know how to tell if my result is a whole number for an
expression.

1 divided by 3 = 0.33333
2 divided by 3 = 0.66666
3 divided by 3 = 1

I want a formula to give me a result if the answer is a whole number.

Kent Baldwin
using C5.5PEH ABC
good email address:
WENATVMPBQND@spammotel.com
John Christ

2006-06-24, 7:55 am

Kent,

> I want a formula to give me a result if the answer is a whole number.


Theoretically this should work:

IF (TestValue - INT(TestValue)) = 0
! Result is a whole number
END

but if TestValue is a REAL, I wouldn't be surprised if you get bit <g>

John


Abe Jimenez

2006-06-24, 7:55 am

X % Y returns the remainder of X / Y. If 0, then the result of X/Y is a
whole number

1 % 3 = 1
2 % 3 = 2
3 % 3 = 0

--

Regards,
Abe Jimenez


"Kent Baldwin" <WENATVMPBQND@spammotel.com> wrote in message
news:141o929uj7d3akd29ndmhmkqem36na8ot0@
4ax.com...
>I need to know how to tell if my result is a whole number for an
> expression.
>
> 1 divided by 3 = 0.33333
> 2 divided by 3 = 0.66666
> 3 divided by 3 = 1
>
> I want a formula to give me a result if the answer is a whole number.
>
> Kent Baldwin
> using C5.5PEH ABC
> good email address:
> WENATVMPBQND@spammotel.com



Kent Baldwin

2006-06-24, 7:55 am

Would

6 % 3 = 0
9 % 3 =0
and so on, then?

On Fri, 23 Jun 2006 11:37:39 -0400, "Abe Jimenez"
<nospam@bellsouth.net> wrote:

>X % Y returns the remainder of X / Y. If 0, then the result of X/Y is a
>whole number
>
>1 % 3 = 1
>2 % 3 = 2
>3 % 3 = 0


Kent Baldwin
using C5.5PEH ABC
good email address:
WENATVMPBQND@spammotel.com
George

2006-06-24, 7:55 am

Kent,

Try this:

!
****************************************
****************************************
*******
chkRemainder Procedure(String pStr)
!
****************************************
****************************************
*******
CODE
If InString('.', pStr, 1, 1)
Return(TRUE)
Else
Return(FALSE)
End
!
****************************************
****************************************
*******

If you need an example send me an email.

Regards,
George

Kent Baldwin wrote:
> I need to know how to tell if my result is a whole number for an
> expression.
>
> 1 divided by 3 = 0.33333
> 2 divided by 3 = 0.66666
> 3 divided by 3 = 1
>
> I want a formula to give me a result if the answer is a whole number.
>
> Kent Baldwin
> using C5.5PEH ABC
> good email address:
> WENATVMPBQND@spammotel.com


Abe Jimenez

2006-06-24, 7:55 am

Yes. Look in the help for modulus

--

Regards,
Abe Jimenez


"Kent Baldwin" <WENATVMPBQND@spammotel.com> wrote in message
news:l7fo92dl05lh79r7dta4rgk8437pp7ra07@
4ax.com...
> Would
>
> 6 % 3 = 0
> 9 % 3 =0
> and so on, then?
>
> On Fri, 23 Jun 2006 11:37:39 -0400, "Abe Jimenez"
> <nospam@bellsouth.net> wrote:
>
>
> Kent Baldwin
> using C5.5PEH ABC
> good email address:
> WENATVMPBQND@spammotel.com



Kent Baldwin

2006-06-24, 7:55 am

Got it. THank you!
Kent

On Fri, 23 Jun 2006 17:42:49 -0400, "Abe Jimenez"
<nospam@bellsouth.net> wrote:

>Yes. Look in the help for modulus


Kent Baldwin
using C5.5PEH ABC
good email address:
WENATVMPBQND@spammotel.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com