Largest double value ...
Author Message
Largest double value ...

Hello -

What is the best way to get an expression for the largest double value? I
cannot find a macro for it in limits.h.

Thanks,

Joachim

Tue, 30 Dec 2003 00:01:57 GMT
Largest double value ...

Quote:
> Hello -
> What is the best way to get an expression for the largest double value? I
> cannot find a macro for it in limits.h.

You're not looking hard enough. It's called DBL_MAX, and it IS in
limits.h.

--

| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste       W++ B OP+                     |
\----------------------------------------- Finland rules! ------------/

"Insanity is to be shared."
- Tailgunner

Tue, 30 Dec 2003 00:08:35 GMT
Largest double value ...

Quote:

> Hello -

> What is the best way to get an expression for the largest double value? I
> cannot find a macro for it in limits.h.

It's in float.h: DBL_MAX

HTH, Tobias.

Tue, 30 Dec 2003 00:21:17 GMT
Largest double value ...

Quote:
>  What is the best way to get an expression for the largest double value? I
>  cannot find a macro for it in limits.h.

That's because the macros that describe floating point features are
in <float.h>, not <limits.h>. For your specific question, see
DBL_MAX, which must be at least 1E+37.

Gergo

--
Today's weirdness is tomorrow's reason why.
-- Hunter S. Thompson

Tue, 30 Dec 2003 00:26:24 GMT
Largest double value ...

Quote:

>Hello -

>What is the best way to get an expression for the largest double value? I
>cannot find a macro for it in limits.h.

Try DBL_MAX in <float.h>.

--
Stefan Farfeleder

Tue, 30 Dec 2003 00:30:57 GMT
Largest double value ...

Quote:

> > Hello -

> > What is the best way to get an expression for the largest double value? I
> > cannot find a macro for it in limits.h.

> You're not looking hard enough. It's called DBL_MAX, and it IS in
> limits.h.

No, it's in float.h.
--
Moving to Palo Alto, CA on September 20, 2001, to start PhD work
at Stanford.  Anyone want to hang out after that?

Tue, 30 Dec 2003 00:55:42 GMT
Largest double value ...

Quote:

> Hello -

> What is the best way to get an expression for the largest double value? I
> cannot find a macro for it in limits.h.

That's because <limits.h> is for integer types:

#include <float.h>
#include <stdio.h>

int main(void)
{
printf("|Ranges| for floating types on this implementation:\n\n");
printf("float: %g to %g\n", FLT_MIN, FLT_MAX);
printf("double: %g to %g\n", DBL_MIN, DBL_MAX);
printf("long double: %Lg to %Lg\n", LDBL_MIN, LDBL_MAX);
return 0;

Quote:
}

|Ranges| for floating types on this implementation:

float: 1.17549e-38 to 3.40282e+38
double: 2.22507e-308 to 1.79769e+308
long double: 3.3621e-4932 to 1.18973e+4932

Tue, 30 Dec 2003 01:15:41 GMT
Largest double value ...

Quote:

> > Hello -

> > What is the best way to get an expression for the largest double value? I
> > cannot find a macro for it in limits.h.

> You're not looking hard enough. It's called DBL_MAX, and it IS in
> limits.h.

** BZZT **
No, it's not.

Tue, 30 Dec 2003 01:16:28 GMT
Largest double value ...

Quote:

>> > Hello -

>> > What is the best way to get an expression for the largest double value? I
>> > cannot find a macro for it in limits.h.

>> You're not looking hard enough. It's called DBL_MAX, and it IS in
>> limits.h.
> No, it's in float.h.

Ah, fooled by the old "standard vs. implementation" trick. On the
system I was using (System V Unix), it WAS in limits.h. This made me
think it would always be there. I should really buy a copy of the ANSI C
standard one day...

--

| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste       W++ B OP+                     |
\----------------------------------------- Finland rules! ------------/

"To err is human. To really louse things up takes a computer."
- Anon

Tue, 30 Dec 2003 01:25:16 GMT
Largest double value ...

Quote:

> >> It's called DBL_MAX, and it IS in limits.h.

> > No, it's in float.h.

> Ah, fooled by the old "standard vs. implementation" trick. On the
> system I was using (System V Unix), it WAS in limits.h. This made me
> think it would always be there. I should really buy a copy of the ANSI C
> standard one day...

K&R2 would have been enough in this case, and should be already open, on

:-)

--

"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton

Tue, 30 Dec 2003 01:46:19 GMT
Largest double value ...

Quote:

> K&R2 would have been enough in this case, and should be already
> open, on your desk, *all* the time.

Nah.  "less ~/doc/iso9899-1999.txt" works at least as well.

Tue, 30 Dec 2003 01:46:01 GMT
Largest double value ...
Online documentation? Ick.

Quote:

> Nah.  "less ~/doc/iso9899-1999.txt" works at least as well.

--
== Eric Gorr ===== http://www.*-*-*.com/ :9293199 ===
"Therefore the considerations of the intelligent always include both
benefit and harm." - Sun Tzu
== Insults, like {*filter*}, are the last refuge of the incompetent... ===

Tue, 30 Dec 2003 06:07:49 GMT
Largest double value ...

Quote:

> Online documentation? Ick.

Quote:

> > Nah.  "less ~/doc/iso9899-1999.txt" works at least as well.

--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan

Tue, 30 Dec 2003 06:39:18 GMT
Largest double value ...

Quote:

> > K&R2 would have been enough in this case, and should be already
> > open, on your desk, *all* the time.

> Nah.  "less ~/doc/iso9899-1999.txt" works at least as well.

Not here. Chapter and verse please? ;-)

--
Tor <torust AT online DOT no>

Tue, 30 Dec 2003 18:12:23 GMT
Largest double value ...

Quote:

> > Online documentation? Ick.

> I can't grep dead trees.

Sure you can, although it would likely be slower and, perhaps, require
another computer and other stuff.

I figure all you would need is something to turn the pages of the book,
a camera to take a photo of the page, something to turn those pictures
into text documents and then use the grep command to search that
converted text and report back to you what it found.

--
== Eric Gorr ===== http://www.*-*-*.com/ :9293199 ===
"Therefore the considerations of the intelligent always include both
benefit and harm." - Sun Tzu
== Insults, like {*filter*}, are the last refuge of the incompetent... ===

Tue, 30 Dec 2003 22:39:45 GMT

 Page 1 of 2 [ 23 post ] Go to page: [1] [2]

Relevant Pages