From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,287e8ed2b0c0aabf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-31 14:18:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!feed2.news.rcn.net!feed1.news.rcn.net!rcn!not-for-mail From: Dan Nagle Newsgroups: comp.lang.ada Subject: Re: Zeller's Algorithm Date: Wed, 31 Jul 2002 17:15:51 -0400 Organization: Purple Sage Computing Solutions, Inc. Message-ID: <5lkgkukkd7ofjmdpkpfd89n33vf93b8aen@4ax.com> References: <3D3DED1F.24DE3AC8@lmco.com> <3D46CA0E.BCD17D9C@none.provided> <3D470EEE.811F758D@lmco.com> <719a5d07.0207310251.8f1adef@posting.google.com> <3D483A0B.46EB2F7C@san.rr.com> <1028145549.13341@master.nyc.kbcfp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: UmFuZG9tSVbpHsFWphE5YHNfzjnabK6+8WAFkJiG3E6PvGHEdBL4vK77FRLyS/Bh X-Complaints-To: abuse@rcn.com NNTP-Posting-Date: 31 Jul 2002 21:17:02 GMT X-Newsreader: Forte Agent 1.9/32.560 Xref: archiver1.google.com comp.lang.ada:27537 Date: 2002-07-31T21:17:02+00:00 List-Id: Hello, The Fortran 95 standard has two intrinsic functions, mod() and modulo(), which have subtly different definitions. I wonder which one the C++ committee thought they were modeling? BTW, the Fortran 2000 standard doesn't change anything here, so you can check this for free at http://www.j3-fortran.org and clicking on Fortran 200x for a few megabytes of PDF of the current draft standard. -- Cheers! Dan Nagle Purple Sage Computing Solutions, Inc. On Wed, 31 Jul 2002 16:01:27 -0400, Hyman Rosen wrote: >Darren New wrote: >> Robert A Duff wrote: >>>Doesn't this make the % operator totally useless for negative numbers? >> Yes. > >No. It is required in C or C++ that for non-zero b, > a / b * b + a % b == a > >When division rounds towards zero, as is usually desired >(the C++ standard claims that this is what the Fortran >standard requires), this forces the remainder operation >to return negative results. Eg., we want -3 / 2 == -1, >so we must have -3 % 2 == -1 for the requirement to hold.