Linked Questions

3 votes
4 answers
18k views

I'm reading R5RS spec and it shows this: (modulo 13 4) ===> 1 (remainder 13 4) ===> 1 (modulo -13 4) ===> 3 (remainder -13 4) ...
jcubic's user avatar
  • 67.1k
5 votes
3 answers
4k views

In C the following code ... #include<stdio.h> #include<string.h> #include<stdbool.h> #include<stdlib.h> int main() { int result = (-12) % (10); printf("-12 mod 10 = %d\...
SA610's user avatar
  • 55
0 votes
6 answers
2k views

I want to print all Thursdays between these date ranges from datetime import date, timedelta sdate = date(2015, 1, 7) # start date edate = date(2015, 12, 31) # end date What is the best pythonic ...
sam's user avatar
  • 19.3k
2 votes
2 answers
2k views

Why is the following true? print(-7 % 6 == 5); This means that -7 % 6 yields 5, but I would expect to see -1 (in JavaScript this is the case). Proof in DartPad.
creativecreatorormaybenot's user avatar
5 votes
1 answer
1k views

The definition of Euclidean division says: Given two integers a and b, with b ≠ 0, there exist unique integers q and r such that a = bq + r and 0 ≤ r < |b|, where |b| denotes the absolute value of ...
overexchange's user avatar
  • 17.3k
0 votes
2 answers
248 views

Background This question is inspired by The Caesar Cipher. Given a modified ASCII value i where i > 122 or i < 97, the goal is to find the char represented by its value. For example, since 'z' ...
Ori David's user avatar
  • 372
-3 votes
2 answers
724 views

i need to create a python conways game of life. i have this code given below from book "how to automate boring stuff with python" i had run this code but the output doesn't seem that the ...
Focus 360's user avatar
0 votes
1 answer
379 views

I'm working on a modular sorter in python3 and have noticed weird behavior to do with the signs of input variables when taking the mod. I intend for it to sort a value by the remainder after dividing ...
Mr. Sir's user avatar
  • 17
0 votes
2 answers
361 views

I get that the modulo operator (%) is used to get the remainder of a division, so for example: 7 % 3 = 1 But, why does 1 % 60 = 1 and not 0.084? (1 - 0.016) Why does -1 % 60 = 59? There must be ...
ximeng86's user avatar
0 votes
1 answer
144 views

I have a problem with output of the following C program. It does not get me the correct output.I transform this program from the sum of two big numbers. So I get the output with some "errors" like "...
Vasile Ropot's user avatar
2 votes
1 answer
147 views

Hi I'm trying to do some math on some BigInteger. I'm converting some code from Python to C# and the results I'm getting in C# compared to Python is different. Here's the code in C# BigInteger two = ...
John-Michael's user avatar
3 votes
1 answer
136 views

I have a program that takes two imperial lengths (miles, yards, feet and inches) and outputs their sum and difference. My problem is that when the difference is negative, the output is incorrect. def ...
user avatar
-1 votes
2 answers
89 views

I made a prototype code on python to see if the logic works and later coded it in c++. But for some reason the python version and c++ version return different results. I am not able to figure out why ...
sparkles's user avatar
  • 174
1 vote
1 answer
123 views

I'm designing an algorithm in python and know I'll want to translate it to C later. However, mathematical operations in Python might not yield the same result as in C, for instance 4294967295 + 1 = 0 ...
gdelab's user avatar
  • 6,230
0 votes
1 answer
60 views

Why the outputs of python and vb.net are different, the python result is the correct and expected output. Vb.net gives a wrong answer. how to rectify this? option strict on. lm = -...
Pretty Girl's user avatar

15 30 50 per page
1 2
3