2012-11-30から1日間の記事一覧
Pythonで割り算に負の数を含めるとC/C++と違う挙動をする. :::sh $ python -c "print 4//(-3)" -2 $ gcc -xc - int main() { printf("%d\n", 4 / (-3)); } $ ./a.out -1 pythonは負の無限大方向に丸めてくれる. これは数学的に望ましいらしい(The History …
Pythonで割り算に負の数を含めるとC/C++と違う挙動をする. :::sh $ python -c "print 4//(-3)" -2 $ gcc -xc - int main() { printf("%d\n", 4 / (-3)); } $ ./a.out -1 pythonは負の無限大方向に丸めてくれる. これは数学的に望ましいらしい(The History …