Questions tagged [integer-division]

Anything related to the integer division operation, i.e. that special form of division which is performed between two integer numbers and which in math results in a quotient and a remainder. This is mostly relevant for languages which have specific integer data-types, for which the division is an integer division, or for languages having a specific operator/function to perform integer division.

Anything related to the integer division operation, i.e. that special form of division which is performed between two integer numbers and which in math results in a quotient and a remainder. This is mostly relevant for languages which have specific integer data-types, for which the division is an integer division, or for languages having a specific operator/function to perform integer division.

619 questions
0
votes
2 answers

Division not giving the expected result

Code: float cordsStepAmountHeight; float cordsStepAmountWidth; coordStepAmountHeight=(2.0f/height); coordStepAmountWidth=(2.0f/width); Where width is 2560 and height is 1504 (the resolution of my device). After the calculation, the value of…
Zippy
  • 3,826
  • 5
  • 43
  • 96
0
votes
3 answers

Big-O of division

What is the Big-O of division on most modern day ISAs? Is there some kind of optimization or is it the naive O(numerator/denominator)? I'm writing code that relies heavily of modulus operation. For example, what is the relative times taken to…
user1210233
  • 2,730
  • 5
  • 24
  • 31
0
votes
2 answers

How to extract the first three digits after the decimal point in any calculation in Perl?

For a simple division like 1/3, if I want to extract only the first three digits after the decimal point from the result of division, then how can it be done?
prashant
  • 97
  • 1
  • 1
  • 8
0
votes
3 answers

Division in python. 7/9 = 0? How to stop this?

Possible Duplicate: how can I force division to be floating point in Python? I'm very sorry if this question has been asked already. timothy_lewis_three_pointers_attempted = 4 timothy_lewis_three_pointers_made = 2 print 'three pointers…
dylan
  • 51
  • 1
  • 1
  • 4
0
votes
2 answers

find the min and max of the set of prime factor of a number with the same power in Mathematica

Let n=2^10 3^7 5^4...31^2...59^2 61...97 be the factorization of an integer such that the powers of primes are non-increasing. I would like to write a code in Mathematica to find Min and Max of prime factor of n such that they have the same…
asd
  • 337
  • 3
  • 5
  • 13
0
votes
1 answer

Need to know if a number is divisible after an operation

I have a number on which I perform a specific operation I want to make sure that the number is still divisible after the operation. Let's say I have an integer x which is divisible by PAGE_S does this produces an integer which is also divisible by…
stdcall
  • 27,613
  • 18
  • 81
  • 125
0
votes
1 answer

Integer division with Cortex-M0 under RVDS

I am trying to divide a 64 bits integral type to a 32 bits one, and I am using RVDS 4.1 as a tool-chain. Cortex-M0 does not have hardware divisor, so can I do the operation below? If so How? unsigned long int b = 2590202; unsigned long long int a =…
albin
  • 773
  • 1
  • 8
  • 27
0
votes
1 answer

Python Tkinter Temperature Converter

so i am making a temp converter and i just cant get it to the calc for Fahrenheit to Celsius. It works to go from Celsius to Fahrenheit but it wont convert the other way. I am not sure what problem is causing this i have tried the intvars and…
user1352461
  • 3
  • 1
  • 2
-1
votes
2 answers

Dividing given amount of people into same size groups with remainder forming 1 more group on top, Without using if-statements

So I am trying to figure out how to divide the given amount of people into given group sizes for example: 11 people into groups of 3, and the program giving the answer 4, since the remainder should form a group also on top, as only one group can…
Nohahhex
  • 11
  • 1
-1
votes
1 answer

Can I divide two alias columns in BigQuery?

I'm trying to get the percentage of times something occurs (a task requires an outbound call) So I made a count distinct of the occurrence "CALLED THE CUSTOMER" and aliased it as outbound_calls. And counted all the tasks alias "total_tasks" These…
AngelCel
  • 13
  • 3
-1
votes
1 answer

How can I change this to accept doubles and make factor2 not return zero?

The code below is supposed to randomly create two integer numbers which will then be displayed to a user who then needs to divide the two numbers; however, when I try to change the answer or response to both be doubles it doesn't work. If you do run…
-1
votes
4 answers

SQL result column showing no value due to precision?

Here is a query in PostgreSQL: SELECT 25/8175133 This show 0 as result, while the actual value is 0.00000305805 I tried SELECT CAST(25/8175133 AS DECIMAL) SELECT CAST(25/8175133 AS AS DOUBLE PRECISION) but nothing seems to work. Is there are way…
ozzboy
  • 2,672
  • 8
  • 42
  • 69
-1
votes
1 answer

How to speed up my code : find five odd dividers only. The number of even dividers is no limit

I need to find all numbers in range (45 000 000, 50 000 000 +1), which have five odd dividers only. The number of even dividers has no limit. Here my code is too slow listN=[] for i in range (45000000,50000000+1): sqrtI=i**0.5 counter=0 …
Max Sh
  • 109
  • 6
-1
votes
1 answer

Getting milliseconds from date.getTime() on Android API level 19

I need to get a date-time string in the format "yyyy-MM-dd'T'HH:mm:ss.SSSZ" where SSS are the digits for milliseconds (from 000 to 999). I wrote the following code snippet: Date date=Calendar.getInstance().getTime(); String currentDateTimeString =…
P5music
  • 3,197
  • 2
  • 32
  • 81
-1
votes
6 answers

How to check if the number is divisible by another one Python

I got a problem, when I need to check ff the number is divisible by 3, it should return “Divi”. If it is divisible by 3, it should return “Sible”. If it is divisible by both 2 and 3, it should return “DiviSible”. I tried this code, however if my x =…
Petra Jakub
  • 35
  • 1
  • 8