Re: % operator incompatibility...
From: Arjen Markus (arjen.markus_at_wldelft.nl)
Date: 03/30/04
- Previous message: ulis: "Re: writing binaries in a file"
- In reply to: Derk Gwen: "Re: % operator incompatibility..."
- Next in thread: Volker Hetzer: "Re: % operator incompatibility..."
- Reply: Volker Hetzer: "Re: % operator incompatibility..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Mar 2004 08:57:30 +0200
Derk Gwen wrote:
>
> "Volker Hetzer" <volker.hetzer@ieee.org> wrote:
> # Hi!
> # When I do expr -1%360 in tcl I get 359.
> # When I do this in C I get -1.
> # Why the difference?
>
> Try Pascal and Ada as well. Everybody agrees when the numbers are positive.
> They don't agree when either or both are negative.
>
Well, I just checked:
Fortran (at least as of the Fortran 90 standard) defines two functions:
MOD - the remainder function
MODULO - the modulo function
I think the confusion arises because people assume that the remainder
is identical to modulo.
Still, the solution offered by plain C is the worst: leave it up to the
machine to select modulo or remainder ....
Regards,
Arjen
- Previous message: ulis: "Re: writing binaries in a file"
- In reply to: Derk Gwen: "Re: % operator incompatibility..."
- Next in thread: Volker Hetzer: "Re: % operator incompatibility..."
- Reply: Volker Hetzer: "Re: % operator incompatibility..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|