Post Reply 
Integer Division
03-05-2014, 09:29 PM
Post: #1
Integer Division
Is there an operator for integer division? (I know about IP(value), but was looking for something like '\').

Thanks,

-Dale-
Find all posts by this user
Quote this message in a reply
03-05-2014, 10:39 PM (This post was last modified: 03-05-2014 10:39 PM by Mark Hardman.)
Post: #2
RE: Integer Division
(03-05-2014 09:29 PM)DrD Wrote:  Is there an operator for integer division? (I know about IP(value), but was looking for something like '\').

You have the Integer Quotient CAS command "iquo()".

In algebraic mode: iquo(122,3) returns 40.

In RPN mode: 122 Enter, 3 Enter iquo(2) returns 40.

Mark Hardman

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
03-05-2014, 10:40 PM
Post: #3
RE: Integer Division
(03-05-2014 09:29 PM)DrD Wrote:  Is there an operator for integer division? (I know about IP(value), but was looking for something like '\').

Thanks,

-Dale-

Are you looking for iquo(a,b) or if you want the remainder as well iquorem(a,b) in the CAS?

Cheers, Terje
Find all posts by this user
Quote this message in a reply
03-06-2014, 10:31 AM
Post: #4
RE: Integer Division
I was hoping to find a SINGLE character that would implement integer division. I was working with a compound expression requiring multiple integer divides, and that expression gets very l-o-o-o-n-g, with the varieties of ixxx(blah,blah) discovered so far.

Some languages use the backslash character, providing a very short solution to integer division.

Example: 5\2=2, integer version.
5/2=2.5 exact version.

(I did try to DEFINE the backslash character for this use, but \ is an invalid name input.)

-Dale-
Find all posts by this user
Quote this message in a reply
03-06-2014, 11:44 AM
Post: #5
RE: Integer Division
(03-06-2014 10:31 AM)DrD Wrote:  I was hoping to find a SINGLE character that would implement integer division.

I miss the "\" operator for integer division too. I'm used to it from UBASIC, which also uses "@" for mod (integer remainder).

There is no single-character integer division operator in PPL. iquo(a,b) is your shortest option, unless you make a user-defined function with an even shorter name. UDF's cannot be infix operators, however, so you're stuck with prefix notation.

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: