My Math Forum c++ returning -0

 Computer Science Computer Science Forum

 May 30th, 2013, 07:00 AM #1 Newbie   Joined: May 2013 Posts: 13 Thanks: 0 c++ returning -0 okay I been working on this along time equation 1 a * b * c = d equation2 d + e = f it would be easy to imagine this 1 * 1 * 1 = n n + 1 = 2 now an attempt at something alittle more complex a * b * c = d = d + e = f ive created 48 blocks of equations that produce 46 subvariables in drawings that are in 2d for reversals of each variable possibility a * b * c = d d + e = f ive coded this into dev c++ and some of the subvariables return -0 google doesn't even have 1 result for -0 I can send anyone a source code or executable that creates a -0 i have the 48 drawings for each possibility in a notepad file and im trying to finish arrainging the equations by functions of + - * / */ = for each of the 6 main variables my idea of this was to make an artificial intelligence and this is the way the code was written length * width * height = time = time + information = existence im asking for help with what a -0 returned out of c++ would imply as ive found 0 help
 May 30th, 2013, 07:27 AM #2 Global Moderator     Joined: Nov 2006 From: UTC -5 Posts: 16,046 Thanks: 938 Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms Re: c++ returning -0 You're not giving us nearly enough information. Certainly there is such a thing as a negative zero in IEEE floating-point, it's reasonably well-known (try searching for that name rather than the string -0 which Google interprets as "webpages not containing 0" which it sensibly refuses to list).
 May 30th, 2013, 08:47 AM #3 Newbie   Joined: May 2013 Posts: 13 Thanks: 0 Re: c++ returning -0 thank u very much....... ive been trying to find out what it means and haven't been able to find any help the best assumption i got was it was an error i can see now it implies -infinity now i can move on what would this imply about my code its working with numbers for now say i input one variable that is an integer it solves all 46 subvariables and some of them output -0's i been stuck on the -0 for awhile and it has stopped my motivation to work on the code
May 30th, 2013, 08:53 AM   #4
Global Moderator

Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: c++ returning -0

Quote:
 Originally Posted by jeremymcbreairty i can see now it implies -infinity
-0 is certainly not the same as -infinity. In IEEE arithmetic -infinity < -0 = 0.

 May 30th, 2013, 09:09 AM #5 Newbie   Joined: May 2013 Posts: 13 Thanks: 0 Re: c++ returning -0 so -0 is the starting point for a negative number that is known to be less than 0? its an extention of the number line to increase accuracy? im looking on wikipedia
May 30th, 2013, 10:36 AM   #6
Global Moderator

Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: c++ returning -0

Quote:
 Originally Posted by jeremymcbreairty so -0 is the starting point for a negative number that is known to be less than 0? its an extention of the number line to increase accuracy?
No and no.

 May 30th, 2013, 10:49 AM #7 Newbie   Joined: May 2013 Posts: 13 Thanks: 0 Re: c++ returning -0 is it just a number that is negative and was rounded to zero because of accuracy?
May 30th, 2013, 10:57 AM   #8
Global Moderator

Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: c++ returning -0

Quote:
 Originally Posted by jeremymcbreairty is it just a number that is negative and was rounded to zero because of accuracy?
It's just a number. It has a negative sign and zero magnitude.

 May 30th, 2013, 11:35 AM #9 Newbie   Joined: May 2013 Posts: 13 Thanks: 0 Re: c++ returning -0 so your saying -0 is like all the other numbers between 0 and -infinity?
May 30th, 2013, 12:58 PM   #10
Global Moderator

Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: c++ returning -0

Quote:
 Originally Posted by jeremymcbreairty so your saying -0 is like all the other numbers between 0 and -infinity?
It's an IEEE number like +0, 0.125, -INFINITY, and NaN.

 Tags returning

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post trueblue Academic Guidance 3 March 21st, 2013 02:43 PM peewster Algebra 5 October 4th, 2012 09:51 AM noah++ Academic Guidance 1 May 5th, 2010 01:51 PM cc2008 New Users 3 March 21st, 2008 12:02 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top