Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Most negative double value

Reply
Thread Tools

Most negative double value

 
 
Peter Ammon
Guest
Posts: n/a
 
      02-19-2004
What's the most negative double value I can get? Is it always
guaranteed to be -DBL_MAX? If so, why (or rather, where)?

Thanks.

 
Reply With Quote
 
 
 
 
Malcolm
Guest
Posts: n/a
 
      02-19-2004

"Peter Ammon" <(E-Mail Removed)> wrote in message
> What's the most negative double value I can get? Is it always
> guaranteed to be -DBL_MAX? If so, why (or rather, where)?
>

Most floating point formats have a negative flag bit which can be set or
unset. The most natural system is for the maximum and minimum to be of the
same magnitude.



 
Reply With Quote
 
 
 
 
Papadopoulos Giannis
Guest
Posts: n/a
 
      02-20-2004
Peter Ammon wrote:
> What's the most negative double value I can get? Is it always
> guaranteed to be -DBL_MAX? If so, why (or rather, where)?
>
> Thanks.
>


It is DBL_MIN and it is always -DBL_MAX in IEEE-754 compliant systems..

--
#include <stdio.h>
#define p(s) printf(#s" endian")
int main(void){int v=1;*(char*)&v?p(Little)(Big);return 0;}

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
 
Reply With Quote
 
Peter Ammon
Guest
Posts: n/a
 
      02-20-2004
Papadopoulos Giannis wrote:
> Peter Ammon wrote:
>
>> What's the most negative double value I can get? Is it always
>> guaranteed to be -DBL_MAX? If so, why (or rather, where)?
>>
>> Thanks.
>>

>
> It is DBL_MIN and it is always -DBL_MAX in IEEE-754 compliant systems..


DBL_MIN on my platform is 2.2250738585072014e-308 which is positive.

--
Pull out a splinter to reply.
 
Reply With Quote
 
Papadopoulos Giannis
Guest
Posts: n/a
 
      02-20-2004
Peter Ammon wrote:
> Papadopoulos Giannis wrote:
>
>> Peter Ammon wrote:
>>
>>> What's the most negative double value I can get? Is it always
>>> guaranteed to be -DBL_MAX? If so, why (or rather, where)?
>>>
>>> Thanks.
>>>

>>
>> It is DBL_MIN and it is always -DBL_MAX in IEEE-754 compliant systems..

>
>
> DBL_MIN on my platform is 2.2250738585072014e-308 which is positive.
>

F**K.....
I should never post again after 02:00 in the morning...

Yes, the most negative value is -DBL_MAX...
The smallest positive is DBL_MIN...

A big sorry...

--
#include <stdio.h>
#define p(s) printf(#s" endian")
int main(void){int v=1;*(char*)&v?p(Little)(Big);return 0;}

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
 
Reply With Quote
 
Christian Bau
Guest
Posts: n/a
 
      02-20-2004
In article <c13jg2$hit$(E-Mail Removed)>,
Papadopoulos Giannis <(E-Mail Removed)> wrote:

> #include <stdio.h>
> #define p(s) printf(#s" endian")
> int main(void){int v=1;*(char*)&v?p(Little)(Big);return 0;}


You are aware that this is nonsense?

If not, then think about it for five minutes before you respond.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-20-2004
Peter Ammon wrote:
> Papadopoulos Giannis wrote:
> > Peter Ammon wrote:
> >
> >> What's the most negative double value I can get? Is it always
> >> guaranteed to be -DBL_MAX? If so, why (or rather, where)?

> >
> > It is DBL_MIN and it is always -DBL_MAX in IEEE-754 compliant systems..

>
> DBL_MIN on my platform is 2.2250738585072014e-308 which is positive.


Which is apparently correct. From N869:

[#10] The values given in the following list shall be
replaced by implementation-defined constant expressions with
(positive) values that are less than or equal to those
shown:

-- the difference between 1 and the least value greater
than 1 that is representable in the given floating
point type, b1-p

FLT_EPSILON 1E-5
DBL_EPSILON 1E-9
LDBL_EPSILON 1E-9

-- minimum normalized positive floating-point number,
bemin-1

FLT_MIN 1E-37
DBL_MIN 1E-37
LDBL_MIN 1E-37

--
Chuck F ((E-Mail Removed)) ((E-Mail Removed))
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

 
Reply With Quote
 
Dan Pop
Guest
Posts: n/a
 
      02-20-2004
In <c132k7$gvp$(E-Mail Removed)> Peter Ammon <(E-Mail Removed)> writes:

>What's the most negative double value I can get? Is it always
>guaranteed to be -DBL_MAX?


Yes.

>If so, why (or rather, where)?


Because the standard uses a sign-magnitude model for the floating point
numbers. 5.2.4.2.2 in C99. Sorry, but the text is next to impossible
to quote in plain text format, without using some special convention,
a la TeX and friends.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Papadopoulos Giannis
Guest
Posts: n/a
 
      02-20-2004
Christian Bau wrote:
> In article <c13jg2$hit$(E-Mail Removed)>,
> Papadopoulos Giannis <(E-Mail Removed)> wrote:
>
>
>>#include <stdio.h>
>>#define p(s) printf(#s" endian")
>>int main(void){int v=1;*(char*)&v?p(Little)(Big);return 0;}

>
>
> You are aware that this is nonsense?
>
> If not, then think about it for five minutes before you respond.


Please explain...

--
#include <stdio.h>
#define p(s) printf(#s" endian")
int main(void){int v=1;*(char*)&v?p(Little)(Big);return 0;}

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
 
Reply With Quote
 
Christian Bau
Guest
Posts: n/a
 
      02-20-2004
In article <c15dn0$r78$(E-Mail Removed)>,
Papadopoulos Giannis <(E-Mail Removed)> wrote:

> Christian Bau wrote:
> > In article <c13jg2$hit$(E-Mail Removed)>,
> > Papadopoulos Giannis <(E-Mail Removed)> wrote:
> >
> >
> >>#include <stdio.h>
> >>#define p(s) printf(#s" endian")
> >>int main(void){int v=1;*(char*)&v?p(Little)(Big);return 0;}

> >
> >
> > You are aware that this is nonsense?
> >
> > If not, then think about it for five minutes before you respond.

>
> Please explain...


Do you think that bigendian and littleendian are the only possibilities?
Could the char that you are reading consist completely of padding bits
in the int, in which case you could get two different results when you
run the program twice?
 
Reply With Quote
 
 
 
Reply

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Flickr: difference between "most relevant" and "most interesting" Max Digital Photography 7 09-26-2007 10:38 PM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM
Negative setup and Negative hold prem_eda VHDL 5 10-11-2004 12:14 PM
Wrong results when comparing negative double variables in an if statement John C Programming 11 05-05-2004 04:06 PM
Invoking the Constructor of the Top Most Class in the Hierarchy from the Bottom most class H.MuthuKumaraRajan Java 3 02-04-2004 01:33 PM



Advertisments