Solved

VC++6:  precision of long double

Posted on 2000-05-09
2
541 Views
Last Modified: 2008-03-06
in <float.h> DBL_DIG is defined to be 15 (max digits of precision. While for lone double it's 15 ifndef _M_M68K, it's 18 if _M_M68K is defined. My program need a precision of 18, guess i will have to define _M_M68K in my program? And BTW, what is the meaning of _M_M68K??

Attachment: <float.h>

#ifndef _M_M68K
#define LDBL_DIG        DBL_DIG                 /* # of decimal digits of precision */
#define LDBL_EPSILON    DBL_EPSILON             /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
#define LDBL_MANT_DIG   DBL_MANT_DIG            /* # of bits in mantissa */
#define LDBL_MAX        DBL_MAX                 /* max value */
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP          /* max decimal exponent */
#define LDBL_MAX_EXP    DBL_MAX_EXP             /* max binary exponent */
#define LDBL_MIN        DBL_MIN                 /* min positive value */
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP          /* min decimal exponent */
#define LDBL_MIN_EXP    DBL_MIN_EXP             /* min binary exponent */
#define _LDBL_RADIX     DBL_RADIX               /* exponent radix */
#define _LDBL_ROUNDS    DBL_ROUNDS              /* addition rounding: near */
#else
#define LDBL_DIG        18                                      /* # of decimal digits of precision */
#define LDBL_EPSILON    1.08420217248550443412e-019L            /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
#define LDBL_MANT_DIG   64                                      /* # of bits in mantissa */
#define LDBL_MAX        1.189731495357231765e+4932L             /* max value */
#define LDBL_MAX_10_EXP 4932                                    /* max decimal exponent */
#define LDBL_MAX_EXP    16384                                   /* max binary exponent */
#define LDBL_MIN        3.3621031431120935063e-4932L            /* min positive value */
#define LDBL_MIN_10_EXP (-4931)                                 /* min decimal exponent */
#define LDBL_MIN_EXP    (-16381)                                /* min binary exponent */
#define _LDBL_RADIX     2                                       /* exponent radix */
#define _LDBL_ROUNDS    1                                       /* addition rounding: near */
#endif
0
Comment
Question by:yu_zhang_denver
2 Comments
 
LVL 3

Accepted Solution

by:
LucHoltkamp earned 50 total points
ID: 2795870
Defining it yourself won't do any good...
The CPU determins the precision, not the define... the compiler sets the define to reflect the CPU the software will run on.
0
 
LVL 1

Expert Comment

by:yz
ID: 2795879
Maybe it won't work even you define _M_M68K, M68K means Motorola 68K microprocessor. even u defined _M_M68K, without the suitable processor, cannot u get the precision of 18.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now