Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 06-03-2010, 01:18 AM   #1
Baseband Member
 
Join Date: May 2010
Posts: 48
Default Power of '0' [Zero]

Guy's I have good topic to discuss our Ideas and our knowledge. To I have a number that is '0' [Zero]. You can discuss about Zero here. Some basic Question...

Quote:
What happen if we divide any thing by Zero?
What happen if we divide Zero by any thing?
What happen if we multiply Zero with any thing?
What is role of Zero in programming language?
Like this all of Question you want, you can discuss here. You can put a question here and also can give an answer.


Thanks:

Alex_tom
__________________

__________________
http://www.soniktechnologies.in/
http://www.samartha.net.in/
Alex_tom is offline   Reply With Quote
Old 06-03-2010, 04:28 AM   #2
j03
~~~~~~~~
 
Join Date: Jan 2005
Location: Wales
Posts: 5,556
Send a message via MSN to j03
Default Re: Power of '0' [Zero]

1. Maths breaks
2. You get zero
3. You get zero
4. I don't know enough about it to give a proper answer.

In fact, 1-3 might be totally wrong too.
__________________

j03 is offline   Reply With Quote
Old 06-03-2010, 02:43 PM   #3
Omnicide now.
 
foothead's Avatar
 
Join Date: May 2009
Location: My own personal hell
Posts: 10,014
Default Re: Power of '0' [Zero]

1. You cannot divide by zero. It is not allowed in the definition of division.
2. 0
3. 0
4. Idk, I am not a programmer.
foothead is offline   Reply With Quote
Old 06-03-2010, 07:26 PM   #4
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: Power of '0' [Zero]

Quote:
What happen if we divide any thing by Zero?
What happen if we divide Zero by any thing?
What happen if we multiply Zero with any thing?
What is role of Zero in programming language?
The answer to 3) is the same in any programming language - you get 0! As is the answer to 2). There's no denying that.

The answer to the other two depends.

1) - Mathematically speaking, foothead is correct. However, many programming languages implement this in different ways - some even handle the situation differently in themselves! The two most common outcomes are either some form of error, or a result representing an invalid number.

Some languages like Java have both. Do the divison with integers and it'll throw an ArithmeticException at runtime. Do the division with floating point values and it'll run perfectly fine but return a NaN value (there's a good reason for this behaviour but that's beyond the scope of this post!)

Essentially, it's not defined mathematically so different languages make up different ways of dealing with the situation - since there's no standard they're not consistent. (As an aside, the same applies when using the modulo operator with negative numbers - this isn't allowed mathematically but lots of languages implement this, just differently! Another one to watch out for.) The important thing is knowing that it's inconsistent so you can check whenever you have to work around this issue.

4) - Again it depends on the language. 0 used to be used to signify pretty much everything that was empty, void, false, or erroneous. In C it's equivalent to false. In javascript / VBA it can be equivalent to null values. However - this isn't very descriptive and can cause confusion to both the machine and its user, so we're fortunately seeing a move away from this ambiguity. More modern languages like Java tend to reserve 0 to mean just that - 0. False is signified by false, null values are signified by null, and errors are signified by exceptions (or more generally, throwables.) So these days in many languages, the short answer to your question is that 0 tends to mean 0, just that and not a lot else!
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 06-03-2010, 08:03 PM   #5
Fully Optimized
 
eslfish's Avatar
 
Join Date: Sep 2008
Posts: 1,604
Send a message via AIM to eslfish Send a message via MSN to eslfish Send a message via Yahoo to eslfish
Default Re: Power of '0' [Zero]

1) Can't divide anything by zero.
2) 0
3) 0
4) Lol. Can't answer that!
__________________
XFIRE: Lindmando STEAM: Lindmando
Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz (2 CPUs), ~3.0GHz
4094MB RAM 500 GB HD ATI Radeon™ HD 5850 8800 GT
Windows 7 64-bit Ultimate
eslfish is offline   Reply With Quote
Old 06-16-2010, 03:01 PM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 7,999
Default Re: Power of '0' [Zero]

1 as divisor tends to zero result tends to infinity.

2, 0

3, 0

4, as a number as a logic state, as an output, really depends on the language you're using.
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 07-16-2010, 12:44 AM   #7
Baseband Member
 
Join Date: May 2010
Posts: 48
Default Re: Power of '0' [Zero]

Quote:
Originally Posted by root View Post
1 as divisor tends to zero result tends to infinity.

2, 0

3, 0

4, as a number as a logic state, as an output, really depends on the language you're using.

Thanks sir !!! You can also arise more question relate with Zero [0] .
__________________

__________________
http://www.soniktechnologies.in/
http://www.samartha.net.in/
Alex_tom is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 11:31 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0