float与double的MAX-MIN

#include "stdafx.h"
#include

#include //浮点数的极大值与极小值在float.h

#include //整数形的极大值与极小值在limits.h



void floatmaxmin(); //函数声明
void doublemaxmin();//函数声明


void floatmaxmin()
{
//floatmax =2*2^127  2^128
//floatmin =1*2^-127
printf("********************float************************\n");
float fmax=3.3928236692093846346337460743177e+38f;
float fmin=5.8774717541114375398436826861112e-39f;
printf("%f\n",fmax);
printf("%.100f\n",fmin);
printf("%f\n%.100f\n",FLT_MAX,FLT_MIN);


}


void doublemaxmin()

{

//doublemax=2*2^1023  2^1024
//doublemin =1*2^-1023

double dmax=1.787693134862315907729305190789e+308;

double dmin=1.1125369292536006915451163586662e-308;
printf("%lf\n",dmax);
printf("%.500lf\n",dmin);
printf("%lf\n%.500lf\n",DBL_MAX,DBL_MIN);






}
void main()
{


floatmaxmin();
printf("********************double************************\n");
doublemaxmin();






}

你可能感兴趣的:(C语言)