Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VC++6:  precision of long double

Posted on 2000-05-09
2
Medium Priority
?
600 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
LucHoltkamp earned 200 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.

604 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