Questions tagged [division]

In mathematics, division (÷) is an arithmetic elementary operation.

In mathematics, especially in elementary arithmetic, division (÷) is an arithmetic operation. Specifically, if b times c equals a (b × c = a) where b is not zero, then a divided by b equals c (a ÷ b = c).

In the expression a ÷ b = c, a is called the dividend, b the divisor and c the quotient.

In programming, division is usually represented by the / symbol. There are two import forms of division in most programming languages:

  • In floating point division which operates on floating point or other rational numeric datatypes, the fractional part of the result is included (to the accuracy provided by the datatype):

    float a = 5.0;
    float b = 2.0;
    float c = a / b;   // c = 2.5
    
  • In integer division which operates on integral numeric datatypes, the fractional part of the result is discarded, as in following example:

    int a = 5;
    int b = 2;
    int c = a / b;     //  c = 2
    
2262 questions
0
votes
0 answers

Large number division results are not correct

I am running this code: while (zahl != 0): buffer = zahl rest = zahl%2 binaryString.append(rest) zahl = int(zahl/int(2)) print("%i / 2 = %i Rest: %i" % (buffer, zahl, rest)) For large numbers, for example:…
r3ngE
  • 13
  • 2
0
votes
0 answers

Dividing a pandas dataframe column of dtype float64 by a floating number is returning only integer

I am using python 3.6.5 and I am getting this problem: df = pd.DataFrame({'a' : [1,2,3] , 'b' : [4,5,7]} , dtype = np.float64) and if I do any kind of division, for instance df['a']/2.0 = 0 0 1 1 2 2 …
0
votes
1 answer

Use subquery and possible join to get population percentage

I'm learning MySQL and I want to make two queries divide the sum(populationcount) values in each query to arrive at a percentage (as a decimal value) listed in a separate column. The goal is to use the first query that I will list below as a…
user10136599
0
votes
4 answers

Are there any methods that returns just the decimal after a division? (Python3)

In python 3, are there any methods that would return just the decimal value after a division? For example, if I divided 4 by 5 in this method, it would return 8.
John
  • 143
  • 2
  • 7
0
votes
2 answers

Solve equation to find divisor that gives remainder of zero

I'm trying to solve the following equation in R for x: (z + x)/y = remainder of zero In other words, I'm trying to find what value should be added to my number "z" so that it divided by "y" gives a remainder of zero. I couldn't find anything about…
rebeca
  • 153
  • 1
  • 3
  • 8
0
votes
0 answers

php mod division (%) with floats

What is going on here: 12 % 4 = 0; // integers (1.2 / 0.1) % 4 = 3; // floats (12) % 4 = 3! $a = 1.2 / 0.1; $b = ((int)$a) % 4; $c = 12 % 4; print_r([ $a, $b, $c, ]);
luky
  • 2,263
  • 3
  • 22
  • 40
0
votes
1 answer

VBScript division decimal by integer returns extra remainder

I'm trying to validate my VBScript function that divides an input value by 1440. When I pass 43.56 as input parameter, it returns me the following result: 0.030250000000000002 while the correct answer is 0.03025 What should I do to make it work…
BohdanZPM
  • 695
  • 2
  • 10
  • 22
0
votes
3 answers

Divide result of 2 queries element wis

I can't find a way to divide the result of my 2 queries. They look like that : SELECT periode, cee_ref_no, SUM(somme) AS total FROM V_STAT_NAMUR WHERE code_ref_no IN (1, 2, 3, 4, 5, 6, 193, 215, 237, 259, 281) AND periode BETWEEN '201401' AND…
Playlist
  • 37
  • 7
0
votes
2 answers

Dividing 2 floating point numbers in C++ produces different results depending on the method used

In C++, why does dividing 2 floating point numbers via 2 different mechanisms (inline and via a function call) output different results as per below? After the following computations where 5 is divided into 4, f1 = 0 and f2 = 0.8. #include…
Guru Josh
  • 566
  • 8
  • 16
0
votes
2 answers

ZeroDivisionError - Pandas

The script is the following - aiming to show the differences in average click through rates by keyword ranking position - highlighting queries/pages with under performing ctrs. Until recently it has been working fine - however it now gives me the…
0
votes
5 answers

How can I show as mobile as desktop?

I created a div, for placing text on image. Here te code:

Andrea P.
  • 55
  • 8
0
votes
1 answer

MySQL how to preserve precisions when using division?

Let us say we have values we've retrieved in the tables, these values are strings so it's fine to divide them. We have this kind of report, but I don't like to handle it thru a Programming Language, yet to run it thru 1 sql query to retrieve all…
NosiaD
  • 587
  • 1
  • 6
  • 18
0
votes
0 answers

Maze by recursive division not working - C

I'm having some trouble with my recursive division generated maze. I know there's something wrong about the recursion, but I just can't find a way to solve it. I also know the code is really big and not optimized at all, but I'm working better on…
0
votes
1 answer

Graphite divideSeries wrong result

I'm using Grafana and Graphite to draw a percentage of "succes" rate in our dashboard: I can draw the success rate I can metric the total But when I try to get the percentage, it doesn't seem to do the division as I was taught in school :) Am…
rascio
  • 8,968
  • 19
  • 68
  • 108
0
votes
1 answer

division making zeros after decimal point in c#

I am doing below code in c# obj.value = decimal_value / 100; Where obj.value is a decimal variable in the model decimal_value is a variable holding a decimal value C# code if (member["LOADINGS"] != "") { decimal loading_temp =…
Sachu
  • 7,555
  • 7
  • 55
  • 94
1 2 3
99
100