Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:33:58+00:00 2026-06-12T09:33:58+00:00

Given the code segment as follow, I just want to know why the maximum

  • 0

Given the code segment as follow, I just want to know

  • why the maximum value of long double is smaller in 64bit than that in 32bit?
  • why 64-bit version cannot expand as much digits as in 32-bit version to fill the “40” precision output?
  • it seems that the values of LDBL_MIN and LDBL_MAX are equal, is that a bug?

I have looked into the float.h files in my machine but cannot find the explicit definition of these macro constants.

Testing Code (Platform = Win7-64bit)

#include <cfloat>
#include <iomanip>
cout<<"FLT_MAX   ="<< setprecision(40) << FLT_MAX  << endl;
cout<<"DBL_MAX   ="<< setprecision(40) << DBL_MAX  << endl;
cout<<"LDBL_MAX  ="<< setprecision(40) << LDBL_MAX << endl;
cout<<"FLT_MIN   ="<< setprecision(40) << FLT_MIN  << endl;
cout<<"DBL_MIN   ="<< setprecision(40) << DBL_MIN  << endl;
cout<<"LDBL_MIN  ="<< setprecision(40) << LDBL_MIN << endl;

32-bit outcome (MinGW-20120426)

FLT_MAX  =340282346638528859811704183484516925440
DBL_MAX  =1.797693134862315708145274237317043567981e+308
LDBL_MAX =1.189731495357231765021263853030970205169e+4932
FLT_MIN  =1.175494350822287507968736537222245677819e-038
DBL_MIN  =2.225073858507201383090232717332404064219e-308
LDBL_MIN =3.362103143112093506262677817321752602598e-4932

64-bit outcome (MinGW64-TDM 4.6)

FLT_MAX  =340282346638528860000000000000000000000
DBL_MAX  =1.7976931348623157e+308
LDBL_MAX =1.132619801677474e-317
FLT_MIN  =1.1754943508222875e-038
DBL_MIN  =2.2250738585072014e-308
LDBL_MIN =1.132619801677474e-317

Thanks.

[Edit]: Using the latest MinGW64-TGM 4.7.1, the “bugs” of LDBL_MAX, LDBL_MIN seems removed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:33:59+00:00Added an answer on June 12, 2026 at 9:33 am

    LDBL_MAX =1.132619801677474e-317 sounds like a bug somewhere. It’s a requirement of the standard that every value representable as a double can also be represented as a long double, so it’s not permissible for LDBL_MAX < DBL_MAX. Given that you haven’t shown your real testing code, I personally would check that before blaming the compiler.

    If there really is a (non-bug) difference in long double between the two, then the basis of that difference will be that your 32-bit compiler uses the older x87 floating point operations, which have 80 bit precision, and hence allow for an 80-bit long double.

    Your 64-bit compiler uses the newer 64-bit floating point operations in x64. No 80-bit precision, and it doesn’t bother switching to x87 instructions to implement a bigger long double.

    There’s probably more complication to it than that. For example not all x86 compilers necessarily have an 80-bit long double. How they make that decision depends on various things, possibly including the fact that SSE2 has 64-bit floating point ops. But the possibilities are that long double is the same size as double, or that it’s bigger.

    why 64-bit version cannot expand as much digits as in 32-bit version
    to fill the “40” precision output?

    A double only has about 15 decimal digits of precision. Digits beyond that are sometimes informative, but usually misleading.

    I can’t remember what the standard says about setprecision, but assuming the implementation is allowed to draw a line where it stops generating digits, the precision of a double is a reasonable place to draw it. As for why one implementation decided to actually do it and the other didn’t — I don’t know. Since they’re different distributions, they might be using completely different standard libraries.

    The same “spurious precision” is why you see 340282346638528859811704183484516925440 for FLT_MAX in one case, but 340282346638528860000000000000000000000 in the other. One compiler (or rather, one library implementation) has gone to the trouble to calculate lots of digits. The other has given up early and rounded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given such a code segment: #include <iostream> #include <iterator> #include <fstream> #include <string> using
i know the basics of recursion but in the given code i m facing
Given this code, tableButton = new JButton(new ImageIcon(80F_FG2015.GIF)); how would I get that String
Given the code below, how would you create/implement SR.h so that it produces the
I want to modify the code snippet below in such a way, that I
Greetings. I am struggling to reduce a code segment that looks rather lengthy, leaving
Is there a construct or pattern in .net that defines a segment of code
With respect to the following code segment: struct Pair{ string name; double val; }
The code segment given below compiles and when run gives the result as :
Given: code inside a stored proc: select bleh into #tblTemp from FunctionThatReturnsTable('some','params') -- do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.