Re: math error: modulo

2011-07-15 Thread Seven Reeds
on redhat

perl -e'print STDOUT (-1 % 12), "\n";'

yeilds 11

I thought php gave 11 but i tried it again and it is giving me -1.

php -r'echo (-1 % 12),"\n";'

Nuts.  Well, a math friend tells me that modulo operators are flakey
and that he always writes his own to make sure he knows what he will
get.

sigh

On Fri, Jul 15, 2011 at 5:25 PM, Alan Chaney  wrote:
> What other languages?
>
> In Java '%' in this case means " the remainder of"
>
> the "remainder of " dividing -1 by 12 is -1, as is -13 %12 or -25 % 12.
>
> I'd be interested to know which other language does what you say.
>
> HTH
>
> Alan
>
>
> On 7/15/2011 3:07 PM, seven.reeds wrote:
>>
>> int x = 0;
>> int y = -1;
>> x = y % 12;
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: math error: modulo

2011-07-15 Thread Jeff Chimene
On 07/15/2011 03:25 PM, Alan Chaney wrote:
> What other languages?
> 
> In Java '%' in this case means " the remainder of"
> 
> the "remainder of " dividing -1 by 12 is -1, as is -13 %12 or -25 % 12.
> 
> I'd be interested to know which other language does what you say.

http://en.wikipedia.org/wiki/Modulo_operation#Modulo_operation

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: math error: modulo

2011-07-15 Thread Alan Chaney

What other languages?

In Java '%' in this case means " the remainder of"

the "remainder of " dividing -1 by 12 is -1, as is -13 %12 or -25 % 12.

I'd be interested to know which other language does what you say.

HTH

Alan


On 7/15/2011 3:07 PM, seven.reeds wrote:

int x = 0;
int y = -1;
x = y % 12;


--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



math error: modulo

2011-07-15 Thread seven.reeds
Hi All,

I have a case where I am trying to issue the following calculation

int x = 0;
int y = -1;
x = y % 12;

In other languages I get the result: x = 11.  In GWT/java I get "-1".
Is there a better way?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.