public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Problems with long double version two...
@ 2002-11-12 10:30 Gabriel Andres Goenaga Jimenez
  2002-11-12 11:38 ` Jeff Spirko
  0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Andres Goenaga Jimenez @ 2002-11-12 10:30 UTC (permalink / raw)
  To: gsl-discuss

I'm tryin the following test program, for long double data type.  I'm 
working in a Pentium II, redhat linux 7.3, and compiling with gcc as follow:
gcc -o test test.c

When I run the program, the results from long double variables present 
problems.  I have tried the same program in a SUN, SUN alfa, silicon 
graphycs architecture and with gcc, CC, cc, g++ compilers and the results 
are the same.

I tried it in DOS with Borland c++ 3.0 compiler and the results were 
corrects.  But I need the corrects results in linux.  Can anybody help me 
please?  I need to work with numbers in the range of long double (1e-4932 to 
1e+4932)

What is the problem?  The compiler, the architecture, or printf function 
definition?


#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  double a,b;
  long double c,d;
  a=1e308;
  b=1e-308;
  c=1e350;
  d=1e-350;

  printf("\nEl valor de a es %le ",a);
  printf("\nEl valor de b es %le ",b);
  printf("\nEl valor de c es %Le ",c);
  printf("\nEl valor de d es %Le ",d);

}

Thanks,


Gabriel Goenaga Jimenez
Graduate Student
Physics Department
University of Puerto Rico



_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.microsoft.com/es

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problems with long double version two...
  2002-11-12 10:30 Problems with long double version two Gabriel Andres Goenaga Jimenez
@ 2002-11-12 11:38 ` Jeff Spirko
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Spirko @ 2002-11-12 11:38 UTC (permalink / raw)
  To: gsl-discuss

On Tue, Nov 12, 2002 at 06:08:11PM +0000, Gabriel Andres Goenaga Jimenez wrote:
>  c=1e350;

Should be:

c=1e350L;

All constants in C are doubles unless otherwise indicated.

-- 
Jeff Spirko   spirko@lehigh.edu   spirko@yahoo.com   WD3V   |=>

The study of non-linear physics is like the study of non-elephant biology.

All theoretical chemistry is really physics;
and all theoretical chemists know it. -- Richard P. Feynman 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-12 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-12 10:30 Problems with long double version two Gabriel Andres Goenaga Jimenez
2002-11-12 11:38 ` Jeff Spirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).