Solved

VC++6:  precision of long double

Posted on 2000-05-09
2
534 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

744 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

14 Experts available now in Live!

Get 1:1 Help Now