Hi
I don't know if this is the right newsgroup but here it comes
I need quadruple precision in my next project and was thinking if a
quadruple type was added to Visual studio 2005 C++?
Thanks Torben Laursen
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.grisoft.com).
Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004 13 2813
Torben Laursen wrote: Hi
I don't know if this is the right newsgroup but here it comes
I need quadruple precision in my next project and was thinking if a quadruple type was added to Visual studio 2005 C++?
No. The floating point types provided by VC++ 2005 are the same as VC++
2003 - float and double. 'long double' is accepted by the parser, but it's
the same type as double in the implementation.
No version VC++ has ever supported "double double" or any form of 128bit
floating point (including VC for 64bit OS's, AFIAK).
-cd
"Torben Laursen" wrote: Hi
I don't know if this is the right newsgroup but here it comes
I need quadruple precision in my next project and was thinking if a quadruple type was added to Visual studio 2005 C++?
have you tried "long double" ?
Thanks Torben Laursen
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004
Hi JimmyC
Long double does not give me much more then double. I need around 25 digits.
Torben
"JimmyC" <Ji****@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
"Torben Laursen" wrote:
Hi
I don't know if this is the right newsgroup but here it comes
I need quadruple precision in my next project and was thinking if a quadruple type was added to Visual studio 2005 C++?
have you tried "long double" ?
Thanks Torben Laursen
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.grisoft.com).
Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004
Jochen Kalmbach wrote: Hi Torben Laursen,
Long double does not give me much more then double. I need around 25 digits.
long double doesn't give you any more than double on VC++. Then you should use "decimal" ! It has 28-29 significat digits!
Note that decimal is a .NET type, not a native C++ type. The .NET decimal
type is a wrapper on the OLE Automation decimal type.
-cd
"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:eB**************@TK2MSFTNGP15.phx.gbl... Jochen Kalmbach wrote: Hi Torben Laursen,
Long double does not give me much more then double. I need around 25 digits.
long double doesn't give you any more than double on VC++.
Then you should use "decimal" ! It has 28-29 significat digits!
Note that decimal is a .NET type, not a native C++ type. The .NET decimal type is a wrapper on the OLE Automation decimal type.
Carl,
As far as I see it's not wrapping anything OLE, System::Decimal is a pure
CLR type.
Willy.
Hi Willy Denoyette [MVP], Note that decimal is a .NET type, not a native C++ type. The .NET decimal type is a wrapper on the OLE Automation decimal type.
Carl,
As far as I see it's not wrapping anything OLE, System::Decimal is a pure CLR type.
At least it has the following private members:
<code>
private int flags;
private int hi;
private int lo;
private int mid;
</code>
And for example Abs is implemented with:
<code>
return new decimal(d.lo, d.mid, d.hi, d.flags & 0x7fffffff);
</code>
--
Greetings
Jochen
My blog about Win32 and .NET http://blog.kalmbachnet.de/
Willy Denoyette [MVP] wrote: Carl,
As far as I see it's not wrapping anything OLE, System::Decimal is a pure CLR type.
Actually, I've never really looked into the implementation in the production
..NET BCL. In the Rotor sources, decimal is a wrapper on OLE decimal. It's
not a complete wrapper though - many of the operations are implemented
directly in c#, but the core arithmetic operations are written in C++ and
simply delegate to the OLE implementation. I'd always assumed that the
production version was the same, since by and large the Rotor source is the
same as the .NET source. Perhaps this is one area where they're different.
-cd
Carl Daniel [VC++ MVP] wrote: Actually, I've never really looked into the implementation in the production .NET BCL. In the Rotor sources, decimal is a wrapper on OLE decimal. It's not a complete wrapper though - many of the operations are implemented directly in c#, but the core arithmetic operations are written in C++ and simply delegate to the OLE implementation. I'd always assumed that the production version was the same, since by and large the Rotor source is the same as the .NET source. Perhaps this is one area where they're different.
I just had a look at the .NET 1.1 BCL sources, and decimal is still a
(partial) wrapper over the OLE decimal type. Operations like Add, Subtract,
Remainder, Compare, conversion to/from float/double, all delegate to their
VarDecXxxx counterparts.
-cd
Carl,
You are right, Decimal uses some oleaut32 functions to convert some types
to/from Decimal, but I would not say that because of this it's actually
wrapping an Decimal OLE type.
The CLR Decimal type is declared as (in the BCL):
Note: this is exactly the same as an OLE Decimal type, so it's obvious why
they use the OLEAUT conversion routines.
private int flags;
private int hi;
private int lo;
private int mid;
Where lo, mid and hi represent the 96-bit integer part of the Decimal. Bits
16-23 of flags contain the power of 10 value to divide the 96-bit part by to
produce the Decimal value. Bit 32 is used for the sign (0 = positive,
1=negative). All other bits unused (must be 0).
Willy.
Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:et**************@TK2MSFTNGP09.phx.gbl... Carl Daniel [VC++ MVP] wrote: Actually, I've never really looked into the implementation in the production .NET BCL. In the Rotor sources, decimal is a wrapper on OLE decimal. It's not a complete wrapper though - many of the operations are implemented directly in c#, but the core arithmetic operations are written in C++ and simply delegate to the OLE implementation. I'd always assumed that the production version was the same, since by and large the Rotor source is the same as the .NET source. Perhaps this is one area where they're different.
I just had a look at the .NET 1.1 BCL sources, and decimal is still a (partial) wrapper over the OLE decimal type. Operations like Add, Subtract, Remainder, Compare, conversion to/from float/double, all delegate to their VarDecXxxx counterparts.
-cd
Willy Denoyette [MVP] wrote: Carl,
You are right, Decimal uses some oleaut32 functions to convert some types to/from Decimal, but I would not say that because of this it's actually wrapping an Decimal OLE type.
It uses more than that - most significantly all of the arithmetic operators
forward to VarDecXxxx as well.
The CLR Decimal type is declared as (in the BCL): Note: this is exactly the same as an OLE Decimal type, so it's obvious why they use the OLEAUT conversion routines.
private int flags; private int hi; private int lo; private int mid;
Where lo, mid and hi represent the 96-bit integer part of the Decimal. Bits 16-23 of flags contain the power of 10 value to divide the 96-bit part by to produce the Decimal value. Bit 32 is used for the sign (0 = positive, 1=negative). All other bits unused (must be 0).
That's why I later said partial wrapper :) But since all of the fundamental
arithmetic operations do use the VarDecXxxxx functions, most of the common
operations on decimal result in calls out to native code. Bottom line -
decimal looks like an intrinsic type, but it's really a complex type with a
lot of code behind common operations. It would be interesting to see some
performance benchmarks comparing decimal to double.
Don't get me wrong - I love decimal. Most of my .NET work is banking, so
decimal is pretty much all I use - but it does come at a cost.
-cd
"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... Willy Denoyette [MVP] wrote: Carl,
You are right, Decimal uses some oleaut32 functions to convert some types to/from Decimal, but I would not say that because of this it's actually wrapping an Decimal OLE type.
It uses more than that - most significantly all of the arithmetic operators forward to VarDecXxxx as well.
The CLR Decimal type is declared as (in the BCL): Note: this is exactly the same as an OLE Decimal type, so it's obvious why they use the OLEAUT conversion routines.
private int flags; private int hi; private int lo; private int mid;
Where lo, mid and hi represent the 96-bit integer part of the Decimal. Bits 16-23 of flags contain the power of 10 value to divide the 96-bit part by to produce the Decimal value. Bit 32 is used for the sign (0 = positive, 1=negative). All other bits unused (must be 0).
That's why I later said partial wrapper :) But since all of the fundamental arithmetic operations do use the VarDecXxxxx functions, most of the common operations on decimal result in calls out to native code.
*** Agreed, but that can be said about most of the .NET API's, at some point
they call native code :-) So can we agree that a great deal of the FCL are
just wrappers around something in native code for the implementation?
Not sure how it's done in the U*ix versions of the CLI where OLEAUT32.DLL is
not available, but I guess is that they implemented this stuff directly in
the CLR, while MSFT uses IJW for the call out to oleaut.
Bottom line - decimal looks like an intrinsic type, but it's really a complex type with a lot of code behind common operations. It would be interesting to see some performance benchmarks comparing decimal to double.
Don't get me wrong - I love decimal. Most of my .NET work is banking, so decimal is pretty much all I use - but it does come at a cost.
*** I've done some benchmarking on Decimal using the beta v1.0 bits. One day
I should run these on v2. and compare the results.
Willy.
Willy Denoyette [MVP] wrote: "Carl Daniel [VC++ MVP]" That's why I later said partial wrapper :) But since all of the fundamental arithmetic operations do use the VarDecXxxxx functions, most of the common operations on decimal result in calls out to native code. *** Agreed, but that can be said about most of the .NET API's, at some point they call native code :-) So can we agree that a great deal of the FCL are just wrappers around something in native code for the implementation?
Oh sure - no argument at all. I just wanted to point out that decimal,
unlike all the other intrinsic numeric types, carries a fairly high
computation burden. I can imagine someone new to programming expecting
decimal and double to have similar performance.
Not sure how it's done in the U*ix versions of the CLI where OLEAUT32.DLL is not available, but I guess is that they implemented this stuff directly in the CLR, while MSFT uses IJW for the call out to oleaut.
I have no idea what the Mono (etc) folks did. I imagine they may well have
found an existing C-language decimal library and adapted it. In the Rotor
sources, decimal is implemented as part of the PAL (Platform Abstraction
Libray - I think that's what they call it anyway).
*** I've done some benchmarking on Decimal using the beta v1.0 bits. One day I should run these on v2. and compare the results.
I'd like to see those results too!
-cd This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brian van den Broek |
last post by:
Hi all,
I guess it is more of a maths question than a programming one, but it
involves use of the decimal module, so here goes:
As a self-directed learning exercise I've been working on a...
|
by: DAVID SCHULMAN |
last post by:
I've been trying to perform a calculation that has been running into
an underflow (insufficient precision) problem in Microsoft Excel, which
calculates using at most 15 significant digits. For this...
|
by: Madan |
last post by:
Hi all,
I had problem regarding float/double arithmetic only with + and -
operations, which gives inaccurate precisions. I would like to know how the
arithmetic operations are internally handled...
|
by: mdeaver2003 |
last post by:
I'm trying to output a double using a precision that
varies, governed by the value of a precision variable.
In C I can do it like this:
double pi = 3.14159;
int prec = 4;
printf( "%.*f",...
|
by: R.Biloti |
last post by:
Hi folks
I wrote the naive program to show up the unit roundoff (machine
precision) for single and double precision:
#include <stdio.h>
int main (void)
{
double x;
|
by: rupert |
last post by:
i've got the following code:
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
int main(double argc, char* argv) {
double r = 0.01;
|
by: Bo Yang |
last post by:
Hi, I am confused by the double type in C++. I don't know whether
below is legal or possible:
double PI = 3.141592675932;
Now, can I get another double variable from PI with lower precision,...
|
by: Matthew |
last post by:
Hi,
I want to change the precision level of floating point variables and
calculations which is done in php.ini.
However the server I rent for my domain does not give me access to
php.ini,...
|
by: Charles Coldwell |
last post by:
James Kanze <james.kanze@gmail.comwrites:
True, with some additional considerations. The commonly used IEEE 754
floating point formats are
single precision: 32 bits including 1 sign bit, 23...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |