Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 1999 13:11:09 +0000
From:      spinner.rflab@t-online.de (Steffen Hein)
To:        freebsd-questions@freebsd.org
Subject:   gnu C compiler
Message-ID:  <36EFA9ED.5126E95C@t-online.de>

next in thread | raw e-mail | index | archive | help
Dear Friends,

How can you explain me that the same gnu C compiler ( release 2.7.2.1 )
in FreeBSD apparently does not handle the long double format correctly
while in Linux it does ?

Compiling the following program 'proto.c' in FreeBSD and in Linux as
# cc -ansi proto.c -o proto.a
and running proto.a in the two systems yields the displayed outputs


/***********************************************************************

C program proto.c
 
***********************************************************************/

# define _POSIX_SOURCE

# include <stdio.h>
# include <stdlib.h>
# include <stddef.h>
# include <stdarg.h>
# include <float.h>
# include <math.h>
# include <string.h>
# include <ctype.h>
# include <locale.h>
# include <unistd.h>

main( )
{
   printf( "\n\n Ranges    :  " );

   printf( "\n\n FLT_MIN      = % le ", FLT_MIN);
   printf( "\n FLT_MAX      = % le ", FLT_MAX );
   printf( "\n DBL_MIN      = % le ", DBL_MIN );
   printf( "\n DBL_MAX      = % le ", DBL_MAX );
   printf( "\n LDBL_MIN     = % Le ", LDBL_MIN );
   printf( "\n LDBL_MAX     = % Le ", LDBL_MAX );

   printf( "\n\n Epsilon   :  " );

   printf( "\n\n FLT_EPSILON  = % le ", FLT_EPSILON );
   printf( "\n DBL_EPSILON  = % le ", DBL_EPSILON );
   printf( "\n LDBL_EPSILON = % Le ", LDBL_EPSILON );

   printf( "\n\n Precision :  " );

   printf( "\n\n FLT_DIG      = % d     ", FLT_DIG );
   printf( "\n DBL_DIG      = % d     ", DBL_DIG );
   printf( "\n LDBL_DIG     = % d     ", LDBL_DIG );

   printf( "\n\n End " );

   exit(NULL);
}

========================================================================

 FreeBSD output:
                                                                                                              
                                                                                                               
                                                                                                               
                                                                                                               
                                                                                                               
 Linux
output:                                                                                                 
                                                                                                               
 Ranges   
:                                                                                                   
                                                                                                               
 FLT_MIN      = 
1.175494e-38                                                                                  
 FLT_MAX      = 
3.402823e+38                                                                                  
 DBL_MIN      = 
2.225074e-308                                                                                 
 DBL_MAX      = 
1.797693e+308                                                                                 
 LDBL_MIN     = 
3.362103e-4932                                                                                
 LDBL_MAX     = 
1.189731e+4932                                                                                
                                                                                                               
 Epsilon  
:                                                                                                   
                                                                                                               
 FLT_EPSILON  = 
1.192093e-07                                                                                  
 DBL_EPSILON  = 
2.220446e-16                                                                                  
 LDBL_EPSILON = 
1.084202e-19                                                                                  
                                                                                                               
 Precision
:                                                                                                   
                                                                                                               
 FLT_DIG      = 
6                                                                                             
 DBL_DIG      = 
15                                                                                            
 LDBL_DIG     = 
18                                                                                            
                                                                                                               
 End
#                                                                                                         
                  
 Ranges    :

 FLT_MIN      =  1.175494e-38
 FLT_MAX      =  3.402823e+38
 DBL_MIN      =  2.225074e-308
 DBL_MAX      =  1.797693e+308 Floating point exception - core dumped


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36EFA9ED.5126E95C>