468,457 Members | 1,643 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

precision in C++

I want to set the computation precision to quadruple precision, how can
I do it in C++ coding?

Thanks all.

Aug 4 '06 #1
9 5909
asdf wrote:
I want to set the computation precision to quadruple precision, how
can I do it in C++ coding?
You can't, unless your compiler somehow enables that. However, there
are libraries out there implementing arbitrary (or simply extended)
precision floating point calculations. Just look for them on the Web.
They may be slower than possible hardware-provided one, but on many
processors it's the only thing available.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 4 '06 #2
"asdf" <li*********@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
:I want to set the computation precision to quadruple precision, how can
: I do it in C++ coding?

Its implementation details depend on the platform, but
would the bult-in type "long double" meet your needs ?

hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <http://www.brainbench.com
Aug 4 '06 #3
"long double" corresponds to double precision, right?
I want to use quadruple precision instead.

Thanks.

Ivan Vecerina wrote:
"asdf" <li*********@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
:I want to set the computation precision to quadruple precision, how can
: I do it in C++ coding?

Its implementation details depend on the platform, but
would the bult-in type "long double" meet your needs ?

hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <http://www.brainbench.com
Aug 4 '06 #4

asdf wrote:
"long double" corresponds to double precision, right?
I want to use quadruple precision instead.

Thanks.
You're asking for too much then. Check GMP mpf_t.

Cheers,

Paulo Matos

Aug 4 '06 #5

Paulo Matos wrote:
asdf wrote:
"long double" corresponds to double precision, right?
I want to use quadruple precision instead.

Thanks.

You're asking for too much then. Check GMP mpf_t.
Let me add GMP as a C++ interface, the type mpf_t corresponds to the
class mpf_class (I think)!
Cheers,

Paulo Matos
Aug 4 '06 #6
Geo

asdf wrote:
"long double" corresponds to double precision, right?
I want to use quadruple precision instead.
No I wouldn't think so,

float - sinlge precision
double - double precision (surprisingly!!!)
long double - greater than double precision

Aug 4 '06 #7
In article <11**********************@i42g2000cwa.googlegroups .com>,
gg@remm.org says...
>
asdf wrote:
"long double" corresponds to double precision, right?
I want to use quadruple precision instead.

No I wouldn't think so,

float - sinlge precision
double - double precision (surprisingly!!!)
long double - greater than double precision
Not really. More accurately, long double is "greater than or equal to
double precision" -- there's no requirement that its precision is
actually greater, and on some widely used implementations (e.g. VC++
2.0 and above) the precision of double and long double is the same.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Aug 4 '06 #8
Jerry Coffin wrote:
In article <11**********************@i42g2000cwa.googlegroups .com>,
gg@remm.org says...
>>
asdf wrote:
>>"long double" corresponds to double precision, right?
I want to use quadruple precision instead.

No I wouldn't think so,

float - sinlge precision
double - double precision (surprisingly!!!)
long double - greater than double precision

Not really. More accurately, long double is "greater than or equal to
double precision" -- there's no requirement that its precision is
actually greater, and on some widely used implementations (e.g. VC++
2.0 and above) the precision of double and long double is the same.
....and on some implementations it's not *much* greater. For example, IIRC,
Borland made use of 'long double' in 10-byte representation, which only
gives you 19 digits of precision (mere 3 more than 'double'), although it
does have a greater range. See "extended double" IEEE 754 format (IIRC).

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 4 '06 #9
asdf wrote:
"long double" corresponds

See below.

Brian

--
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or the group FAQ list:
<http://www.parashift.com/c++-faq-lite/how-to-post.htm>
Aug 4 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Brian van den Broek | last post: by
5 posts views Thread by DAVID SCHULMAN | last post: by
3 posts views Thread by Madan | last post: by
2 posts views Thread by mdeaver2003 | last post: by
6 posts views Thread by R.Biloti | last post: by
2 posts views Thread by rupert | last post: by
10 posts views Thread by Bo Yang | last post: by
reply views Thread by Charles Coldwell | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.