Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #12002

Re: [semi OT] - Lack of long double implementation in VS

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: [semi OT] - Lack of long double implementation in VS
Date 2011-10-23 14:33 -0700
Organization None to speak of
Message-ID <ln39ejo0jl.fsf@nuthaus.mib.org> (permalink)
References <Xns9F87E3C76413Abubbachipsetone@130.133.4.11>

Show all headers | View raw


Bubba <nickname@banelli.biz.invalid> writes:
> I will begin with a humble apology for posting such "impure" article, but 
> I was wandering - shouldn't data types be defined by architecture, and not 
> by compiler? I trust the answer is yes, but having such "by design" flaw 
> by Microsoft just escapes me.

Data types are defined by the compiler.  The characteristics of the
underlying architecture are certainly an important factor for the
compiler authors to consider, but not the only one.

> To my surprise, I found out today (on harder way) that even in VS 2010
>
> {
>     	long double x;
>     	size_t s = sizeof(x):
> }
>
> gives '8', while gcc returns '16' (as expected).

Why did you expect 16?

The standard requires float to support at least 6 decimal digits, double
to support at least 10, and long double to support at least 10.  In
fact, *all* the minimal requirements for long double are the same as
those for double.  The set of values of type double must be a subset of
the set of values of type long double, but they're allowed to be
identical.  (Even so, they're distinct types.)

> Did some homework and read articles but could not find a sane reason for 
> such implementation (due to more than 20 years of 80 bit FPU in x86 
> CPU's).
>
> Is anyone acquainted more detailed about this issue?

Microsoft's decision to make long double the same size as double is
permitted by the C standard.

Whether they *should* have made it bigger is another question, and why
they didn't is yet another.  I don't have an answer to that last one.

> Furthermore, I was shocked to find out that Windows calculator couldn't 
> calculate properly subtraction sqrt(x) and real square root of that number 
> (sqrt(4) - 2, sqrt(16) - 4...).

I have no idea how the Windows calculator is implemented; questions
about it are likely not about C.

[...]

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[semi OT] - Lack of long double implementation in VS Bubba <nickname@banelli.biz.invalid> - 2011-10-23 20:23 +0000
  Re: [semi OT] - Lack of long double implementation in VS Keith Thompson <kst-u@mib.org> - 2011-10-23 14:33 -0700
  Re: [semi OT] - Lack of long double implementation in VS Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-23 18:19 -0400
    Re: [semi OT] - Lack of long double implementation in VS Robert Wessel <robertwessel2@yahoo.com> - 2011-10-23 22:30 -0500
      Re: - Lack of long double implementation in VS "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2011-10-24 10:15 -0700
        Re: - Lack of long double implementation in VS jacob navia <jacob@spamsink.net> - 2011-10-24 21:37 +0200
          Re: - Lack of long double implementation in VS "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2011-10-27 01:58 -0700
            Re: - Lack of long double implementation in VS André Gillibert <MetaEntropy.removeThis@gmail.com> - 2011-10-27 16:28 +0200
              Re: - Lack of long double implementation in VS jacob navia <jacob@spamsink.net> - 2011-10-27 19:02 +0200
  Re: [semi OT] - Lack of long double implementation in VS Kaz Kylheku <kaz@kylheku.com> - 2011-10-24 04:15 +0000
    Re: [semi OT] - Lack of long double implementation in VS Keith Thompson <kst-u@mib.org> - 2011-10-23 23:14 -0700
    Re: [semi OT] - Lack of long double implementation in VS Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-10-27 00:03 +0300
      Re: [semi OT] - Lack of long double implementation in VS Keith Thompson <kst-u@mib.org> - 2011-10-26 14:51 -0700
  Re: - Lack of long double implementation in VS Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-24 00:15 -0700

csiph-web