Why dividing by 0 crashes the program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why dividing by 0 crashes the program?

22nd Mar 2017, 11:38 AM
Jar Vis
Jar Vis - avatar
6 Answers
+ 13
did you skip math class?
22nd Mar 2017, 11:39 AM
Ahri Fox
Ahri Fox - avatar
+ 12
If you don't like that use JavaScript, there 5/0 = Infinity 😃
22nd Mar 2017, 12:39 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 11
I don't find your question absurd. You must be really young, don't worry about it, it's advanced math. Basically, division by zero is UNDEFINED for REAL NUMBERS, that's why it crashes. For example, in ordinary arithmetic: a/b = c a: numerator b: denominator c: quotient The uniqueness of division lies in the ability of recovering the numerator ("a") by inverting the process of multiplication: a = c*b For example: 10/5 = 2 inverting multiplication: 10 = 2*5 But this uniqueness breaks down when dividing by zero, since there is no number which multiplied by zero gives the numerator "a" (assuming "a" is not equal to zero, of course) Examples of incorrect arithmetic divisions: 10/0 = 2 inverting multiplication: 10 != 2*0 10/0 = 0 inverting multiplication: 10 != 0*0 10/0 = 5 inverting multiplication: 10 != 0*5 (" != " means "is not equal to") Although division by zero is UNDEFINED for REAL NUMBERS, you can study this using LIMITS, which may approach INFINITY (∞) Ask yourself: What if I wanted to divide 0/0? What about ∞/∞? and if I wanted to multiply 0 * ∞? Do the subtraction ∞ − ∞? Can I raise 1 to the power of ∞? 0 to the power of 0? Maybe ∞^0? These are called INDETERMINATE FORMS, you're going to be able to find the answers in a Calculus class. Stay curious 😊
4th Apr 2017, 11:12 PM
Pao
Pao - avatar
+ 5
Bro, you cannot divide anything from 0. How can you take 5 chocolates from 0?? OR What fraction of 0 is 5?? What is the answer here man? Hope you got it :-)
22nd Mar 2017, 11:43 AM
Meharban Singh
Meharban Singh - avatar
+ 4
there are the reason behind we don't know actual value that is not complete zero its near to zero like 0.000000000000001 when this value is divided by any number it will give large uncountable value (mathematic rule) that's why it crash the program
25th Mar 2017, 12:29 PM
rishabh kumar verma
rishabh kumar verma - avatar
+ 2
LoL
22nd Mar 2017, 11:41 AM
Meharban Singh
Meharban Singh - avatar