[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

En pudsig ting med modulus



Jeg havde et problem, lidt tid lyst til at eksperimentere lidt. Se her:

Here we go with mother C

13 (mod 5) = 3
-13 (mod 5) = -3
13 (mod -5) = 3
-13 (mod -5) = -3

to follow up with Python,

13(mod 5) = 3
-13(mod 5) = 2
13(mod -5) = -2
-13(mod -5) = -3

Ruby,

13(mod 5) = 3
-13(mod 5) = 2
13(mod -5) = -2
-13(mod -5) = -3

and Perl,

13 (mod 5) = 3
-13 (mod 5) = 2
13 (mod -5) = -2
-13 (mod -5) = -3

and trying Java

13(mod 5) = 3
-13(mod 5) = -3
13(mod -5) = 3
-13(mod -5) = -3

online with JavaScript and PHP

JavaScript

13(mod 5) = 3
-13(mod 5) = -3
13(mod -5) = 3
-13(mod -5) = -3

PHP

13 (mod 5) = 3
-13 (mod 5) = -3
13 (mod -5) = 3
-13 (mod -5) = -3


Det har af og til (måske sjældent) en programmeringspraktisk betydning!
Hvem synes du har ret?

--
Virtually

Niels Müller Larsen
MSc Networked Information Engineering
Multimediedesigneruddannelsen
Erhvervsakademiet Århus Købmandsskole

www.deformation.org



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-10-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *