Integer Division - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Integer Division (/thread-827.html) |
Integer Division - DrD - 03-05-2014 09:29 PM Is there an operator for integer division? (I know about IP(value), but was looking for something like '\'). Thanks, -Dale- RE: Integer Division - Mark Hardman - 03-05-2014 10:39 PM (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 RE: Integer Division - Terje Vallestad - 03-05-2014 10:40 PM (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 '\'). Are you looking for iquo(a,b) or if you want the remainder as well iquorem(a,b) in the CAS? Cheers, Terje RE: Integer Division - DrD - 03-06-2014 10:31 AM 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- RE: Integer Division - Joe Horn - 03-06-2014 11:44 AM (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. |