473,657 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Most negative double value

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.

Nov 14 '05 #1
29 16735

"Peter Ammon" <pe*********@ro cketmail.com> 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.

Nov 14 '05 #2
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):p(Big );return 0;}

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
Nov 14 '05 #3
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.2250738585072 014e-308 which is positive.

--
Pull out a splinter to reply.
Nov 14 '05 #4
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.2250738585072 014e-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):p(Big );return 0;}

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
Nov 14 '05 #5
In article <c1**********@u lysses.noc.ntua .gr>,
Papadopoulos Giannis <ip******@inf.u th.gr> wrote:
#include <stdio.h>
#define p(s) printf(#s" endian")
int main(void){int v=1;*(char*)&v? p(Little):p(Big );return 0;}


You are aware that this is nonsense?

If not, then think about it for five minutes before you respond.
Nov 14 '05 #6
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.2250738585072 014e-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 (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!

Nov 14 '05 #7
In <c1**********@n ews.apple.com> Peter Ammon <pe*********@ro cketmail.com> 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: Da*****@ifh.de
Nov 14 '05 #8
Christian Bau wrote:
In article <c1**********@u lysses.noc.ntua .gr>,
Papadopoulos Giannis <ip******@inf.u th.gr> wrote:

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

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
Nov 14 '05 #9
In article <c1**********@u lysses.noc.ntua .gr>,
Papadopoulos Giannis <ip******@inf.u th.gr> wrote:
Christian Bau wrote:
In article <c1**********@u lysses.noc.ntua .gr>,
Papadopoulos Giannis <ip******@inf.u th.gr> wrote:

#include <stdio.h>
#define p(s) printf(#s" endian")
int main(void){int v=1;*(char*)&v? p(Little):p(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?
Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1887
by: Danny Winslow | last post by:
I get an unexpected result when I add two negative numbers in PHP on SPARC/Solaris 8. The same program works fine on Intel/Linux. I'm using PHP 4.3.1 on both systems. Here is my program, test.php. <?php $a = 0x81234567; $b = 0xF0000002; printx($a, $b);
2
4931
by: Richard van Denzel | last post by:
Hi All, I've defined a table (m) with an double field (bedrag) in it and when I execute the next statement: INSERT INTO m (bedrag) VALUES('-7000,00'); the value get stored correctly. I've written a PHP-script which does the following:
4
2141
by: Charles A. Lackman | last post by:
Hello, I have some textboxes that are doing addition: Dim AString As Double AString = Convert.ToDouble(TextBox1.Text) - Convert.To(DoubleTextBox2.Text) TextBox3.Text = AString.ToString("#,##0.00;(#,##0.00);0.00") When the result is negative it is displayed as "(46)" or whatever the value is.
16
5059
by: JKop | last post by:
Take a class like the following: class Finger { public: double length; }
5
6113
by: Subrahmanyam Arya | last post by:
Hi Folks , I am trying to solve the problem of reading the numbers correctly from a serial line into an intel pentium processor machine . I am reading 1 byte and 2byte data both positive and negative quantities . Can any one tell me what are the things i should bear in mind .
11
2384
by: John | last post by:
Hi, I encountered a strange problem while debugging C code for a Windows-based application in LabWindows CVI V5.5, which led me to write the test code below. I tried this code with a different compiler and got the same erroneous result on two different PCs (with OS Win98 & Win98SE), so it appears to be a problem with ANSI C. I thought that negative double variables could be compared as easily and *reliably* as integers, but apparently...
2
11259
by: Angus Comber | last post by:
Hello Sorry this really is a newbie question! I am doing some floating point arithmetic and calculating the time difference between two dates. The date values being comparied are actually double values. I was going to compare the dates by calculating the difference betwen the two numbers. But sometimes you get a -ve and sometimes a +ve value. I want to disregard a small variance eg of up to two minutes but what is best way to...
2
1469
by: Robert | last post by:
dear sir: I have read the c++ primer plus 5 book, and do the chapter 12 programming exercises question 5, but the average_wait have negative result. I don't understand why? here is the code, thank you anyone replay me.:) /************************* customer.h *************************/ #ifndef CUSTOMER_H_ #define CUSTOMER_H_
8
4245
by: mdeh | last post by:
Hi Everyone, Tried to post via Google..which once again seems to be fritzed...so please excuse if 2 posts show up. I am trying to understand why I am not getting a negative value back, using my version of atof given the argument "-36.63" double atof ( char *s){
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8826
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.