Questions tagged [divide-by-zero]

Division by zero is the division by any value that is exactly equal to 0 -- a computation with an undefined result.

In computing, a program error may result from an attempt to divide by zero. Depending on the programming environment and the type of number (e.g. floating point, integer) being divided by zero, it may generate positive or negative infinity by the IEEE 754 floating point standard, generate an exception, generate an error message, cause the program to terminate, or result in a special NaN (not a number) value.

See also:

540 questions
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
1 answer

Intersect of two planes - divide by zero

I have following alghoritm to find line intersection of two planes: public static function getIntersectOf2Planes ( self $P1 , self $P2 ) { /* Line equation in parametric form: x = x0 + t*a y = y0 + t*b z = z0…
Przemysław Niemiec
  • 1,704
  • 1
  • 11
  • 14
0
votes
1 answer

Python ZeroDivisionError: division by zero occurs while requesting NHL data and writing it into a CSV

I am running into this error: Traceback (most recent call last): File "C:\Python36\Projects\NHL\HANDICAP\NHL_Indiv_TEAM.py", line 55, in item['shotsAgainst']/item['goalsAgainst']+item['shotsAgainst'], ZeroDivisionError: division by…
Michael T Johnson
  • 679
  • 2
  • 13
  • 26
0
votes
0 answers

Exceptions don't work in C++ in XCode & Borland environments

I have a problem about (exceptions in C++). I have been searching for a (long time) to find final solution for this problem; but still I could not find any thing. I have read all answers but no benefit. I tried in C++ Xcode & C++ Borland ! why (try…
SaAd
  • 1
0
votes
1 answer

Invalid literal for float when plotting data read from a file, and a floating point division error

I've got a script that takes the output of a separate C++ executable and creates a scatter plot/bifurcation diagram of the resulting data. The application context is to look at angle values versus the driving force by iterating through multiple…
0
votes
1 answer

How divide overflow occurs when sign of the dividend is same as that of divisor?

As I know, The "Divide Overflow" is an exception that occurs when you try to perform division by zero. I was learning a tutorial about computer architecture and design and I got confused by a statement Divide overflow occurs when the sign of the…
psuresh
  • 535
  • 2
  • 13
  • 25
0
votes
1 answer

Delphi conversion of Lode's untextured raycaster throwing zero division error

So I've been writing a delphi conversion of this untextured raycaster. However, when checking for errors, I noticed that if you walk directly forwards a zero division error occurs. This makes sense as, when it does occur, the camera is inside of a…
DoYouEvenFish
  • 35
  • 1
  • 6
0
votes
0 answers

Division Problems in MYSQL for Calculating Hourly Sales

I would like help with this query to determine the average hourly sales for a user for a month and year. For most months everything is fine, but in this one case, it is producing 13884476534.2960. I know I have some math wrong here, but can't figure…
NullHypothesis
  • 4,286
  • 6
  • 37
  • 79
0
votes
1 answer

Division by zero error: for frequency of different classes

I am calculating the frequency of 3 different classes in images with three values 0-2. I want to obtain the median frequency weighting to balance the imbalanced number of classes. cl1=np.count_nonzero(im == 1) #1=class 1, …
S.EB
  • 1,966
  • 4
  • 29
  • 54
0
votes
2 answers

Any way to shorten this code?

I created this line of code today which determines whether a number divides evenly if (numerator / denominator * denominator) == numerator: print "Divides evenly!" else: print "Doesn't divide evenly." Yet I ran into an issue when dividing…
0
votes
1 answer

Or operator in if statement not working as intended

When I use the following code it works fine: If xMin <> 0 Then If xMax <> 0 Then If xMax / xMin > 2 Then 'some code End If End If End If But I want to use only one if statement to avoid division errors, …
Happy Forever
  • 120
  • 1
  • 8
0
votes
1 answer

Avoiding an error at zero

I am writing a code to find roots of a polynomial for different values of a parameters k and l. This code works fine apart from when the parameter equals zero. My approach has been to offset the zero to a small number (as shown below), but this has…
Chogg
  • 389
  • 2
  • 19
0
votes
0 answers

Error 6: Overflow (failed to read from another cells, 0/0)

I have a problem, I checked a lot of forums, but it doesn't help. I tried few solutions (MsgBox Cells(i,14), but it seems like it doesn't read from cells in the same sheet, because there is 0/0. Here is part of my code: Option Explicit Type…
0
votes
1 answer

Divide by zero exception - Objective-C

So I'm taking an Xcode Objective-C course and we have to make a calculator. Everything works except for the part where I have to create an exception for if someone tries to divide by zero. I cannot for the life of me get it to work and all I keep…
Brooke Taylor
  • 131
  • 2
  • 3
  • 11
0
votes
1 answer

Divide by Zero Exception raised despite edge case

I am trying to handle a divide by zero exception manually in python3.5, however, it keeps ignoring my user defined case and giving the default exception. How can I avoid this? Any help is appreciated. NOTE: I'm using a list as a stack, hence the…
J. Doe
  • 17
  • 4