My Math Forum  

Go Back   My Math Forum > Science Forums > Computer Science

Computer Science Computer Science Forum


Reply
 
LinkBack Thread Tools Display Modes
May 30th, 2013, 08: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
jeremymcbreairty is offline  
 
May 30th, 2013, 08:27 AM   #2
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

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).
CRGreathouse is offline  
May 30th, 2013, 09: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
jeremymcbreairty is offline  
May 30th, 2013, 09:53 AM   #4
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

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.
CRGreathouse is offline  
May 30th, 2013, 10: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
jeremymcbreairty is offline  
May 30th, 2013, 11:36 AM   #6
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

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.
CRGreathouse is offline  
May 30th, 2013, 11: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?
jeremymcbreairty is offline  
May 30th, 2013, 11:57 AM   #8
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

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.
CRGreathouse is offline  
May 30th, 2013, 12:35 PM   #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?
jeremymcbreairty is offline  
May 30th, 2013, 01:58 PM   #10
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

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.
CRGreathouse is offline  
Reply

  My Math Forum > Science Forums > Computer Science

Tags
returning



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning to school trueblue Academic Guidance 3 March 21st, 2013 03:43 PM
all possible combination with returning numbers peewster Algebra 5 October 4th, 2012 10:51 AM
Returning to college -- where to start? noah++ Academic Guidance 1 May 5th, 2010 02:51 PM
Back to school! Returning after an extended absence. cc2008 New Users 3 March 21st, 2008 01:02 PM





Copyright © 2017 My Math Forum. All rights reserved.