nearly no high-level programming languages support it. Not even C

Sure it does. stdlib has the div family of functions, which return a div_t structure with quot and rem fields

Such an operation would be invaluable for things like converting seconds to hours, minutes, and seconds, binary to decimal conversion, or base62 encoding, and it's essential to any kind of rational (as in fractional) data type. With modern languages that support tuples I think it's a shame that we have regressed to writing two expressions to extract both components of what is essentially a value pair

This is similar to the characteristic/mantissa pair which form a logarithm (and is in some ways the exact same issue). It would be frustrating to have to call charac(15) to get 1 and mant(15) to get .1761, and the same is true of integer division


In reply to Re^2: Modulo operation to return quotient and remainder by Borodin
in thread Modulo operation to return quotient and remainder by darklord_999

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.