Article View: alt.pl.matematyka
Article #473Re: jaka reszta z dzielenia -7/3??
From: Stachu 'Dozzie' K.
Date: Mon, 25 Apr 2005 20:54
Date: Mon, 25 Apr 2005 20:54
49 lines
2019 bytes
2019 bytes
On 25.04.2005, Damian Sobota <dam.usun.sob@wp.tezusun.pl> wrote:
> Stachu 'Dozzie' K. napisaล(a):
>> On 25.04.2005, <michfur@neostrada.pl> <michfur@neostrada.pl> wrote:
>>>Czy to prawda ze reszta jest zawsze dodatania?? Czy w tym wypadku reszta
>>>jest 2?? -7/3=-3 r=2
>>>3*-3+2=7
> ^^^^^^
> -7
>
>> Twoje wnioski sa dobre, choc niektore jezyki programowania maja na ten
>> temat swoje zdanie.
>
> Moglbys rozwinac? Dzieki.
#v+
[dozzie@hans c]$ cat test.c
#include <stdio.h>
int main(void)
{
printf("%d\n", -7 % 3);
return 0;
}
[dozzie@hans c]$ gcc test.c -o test && ./test
-1
[dozzie@hans c]$ cat test.hs
module Main where
main :: IO ()
main = do
print (-7 `mod` 3)
[dozzie@hans c]$ ghc test.hs -o test && ./test
-1
[dozzie@hans c]$ echo $(( -7 % 3 ))
-1
[dozzie@hans c]$ php -r 'echo -7 % 3, "\n";'
-1
[dozzie@hans c]$ echo 'puts [expr -7%3]' | tclsh
2
[dozzie@hans c]$ perl -le 'print -7 % 3'
2
[dozzie@hans c]$ python -c 'print -7 % 3'
2
[dozzie@hans c]$
#v-
--
Feel free to correct my English
Stanislaw Klekot
Technical Details
Message-ID:
<slrnd6qms1.l6c.dozzie@hans.zsh.bash.org.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news.dialog.net.pl!not-for-mailReferences:
<d4jk7s$dmt$1@nemesis.news.tpi.pl> <slrnd6qlqk.l6c.dozzie@hans.zsh.bash.org.pl> <d4jl18$io0$1@nemesis.news.tpi.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news.dialog.net.pl!not-for-mail From: "Stachu 'Dozzie' K." <dozzie@dynamit.im.pwr.wroc.pl.nospam> Newsgroups: alt.pl.matematyka Subject: Re: jaka reszta z dzielenia -7/3?? Date: Mon, 25 Apr 2005 20:54:59 +0000 (UTC) Organization: Dialog Net Lines: 49 Message-ID: <slrnd6qms1.l6c.dozzie@hans.zsh.bash.org.pl> References: <d4jk7s$dmt$1@nemesis.news.tpi.pl> <slrnd6qlqk.l6c.dozzie@hans.zsh.bash.org.pl> <d4jl18$io0$1@nemesis.news.tpi.pl> NNTP-Posting-Host: xdsl-2827.wroclaw.dialog.net.pl Mime-Version: 1.0 X-Trace: news.dialog.net.pl 1114462499 12027 81.168.251.11 (25 Apr 2005 20:54:59 GMT) X-Complaints-To: http://www.dialog.pl/dialog/internet/internet.php?id=41 NNTP-Posting-Date: Mon, 25 Apr 2005 20:54:59 +0000 (UTC) User-Agent: slrn/0.9.8.1 (Linux) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit