When comparing 2 dates the DateCalc(d1,d2) function will return +0:0:WW:HH:MM:SS if the d2 > d1, and -0:0:WW:HH:MM:SS if d1 > d2. I think that is return type 0, and there is another return type that shows Years, Months, Days.

If that return value was +1 or -1 then you can just multiple each item with the "flag" to apply the sign bit. I call it a flag, because it only has 2 states -0 or +0.

Thanks for all the suggestions. I thought I might have overlooked a command that would do this. In the program, I opted to use another method of testings that proved to be more efficient. However, this applying a sign bit bugged me. I just needed to know. :) For future reference and to ease my mind.

Here is another, shouldn't 1 + -0 = -1 ?

budman

In reply to Re: Re: Applying Sign Bit by budman
in thread Applying Sign Bit by budman

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.