Wintel编译器:C99 tgmath.h? 16字节“长双”? [英] Wintel compilers with: C99 tgmath.h? 16-byte "long double"?

查看:66
本文介绍了Wintel编译器:C99 tgmath.h? 16字节“长双”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

有关浮点支持的两个问题:


wintel(MS Windows + x86)平台的C编译器是C99

符合< math.h>和< tgmath.h>关注?


什么wintel编译器支持16字节长双 (包含33位十进制

位数的精度),包括正确的printf()支持。我找到了一些支持long double的

编译器,但他们的是8字节或

10字节或12字节类型,精度相同或者与

几乎相同的是普通的8字节双倍。


谢谢

fq


注意:我的号码是通过sizeof获得的。和float.h macros

DBL_DIGITS和LDBL_DIGITS。


这是OpenWatcom 1.2的输出:

FLT_EPSILON = 1.19209e-007

DBL_EPSILON = 2.22045e-016

LDBL_EPSILON = 2.22045e-016

FLT_DIG = 6

DBL_DIG = 15

LDBL_DIG = 15

FLT_MANT_DIG = 24

DBL_MANT_DIG = 53

LDBL_MANT_DIG = 53


和来自Borland 5.5.1:

FLT_EPSILON = 1.19209e-07

DBL_EPSILON = 2.22045e-16

LDBL_EPSILON = 1.0842e- 19

FLT_DIG = 6

DBL_DIG = 15

LDBL_DIG = 18

FLT_MANT_DIG = 24

DBL_MANT_DIG = 53

LDBL_MANT_DIG = 64

和相比之下,来自SUN编译器(在Solaris上):

FLT_EPSILON = 1.19209e-07

DBL_EPSILON = 2.22045e-16
LDBL_EPSILON = 1.92593e-34

FLT_DIG = 6

DBL_DIG = 15

LDBL_DIG = 33

FLT_MANT_DIG = 24

DBL_MANT_DIG = 53

LDBL_MANT_DIG = 113

解决方案



" bq" < FO ********** @ yahoo.com> aécritdansle message de

news:6c ************************** @ posting.google.c om ...

你好,
有关浮点支持的两个问题:

wintel(MS Windows + x86)平台的C编译器是C99
兼容< math.h>和< tgmath.h>有关吗?

lcc-win32。标题可能不符合100%标准,但基本的

硬件支持就在那里。

wintel编译器支持16字节long double。 (精确度为33位十进制数字),包括正确的printf()支持。


lcc-win32支持10字节长双。如果这对你来说太少了,你可以使用350位浮点数。


我找到了一些支持长的编译器双,但他们是8字节或
10字节或12字节类型,精度与普通的8字节双相同或几乎相同。




不,当然,准确性也更好,也是范围。正如你知道的那样,64位与80位不一样。


请随之而来。 wintel编译器必须为intel架构生成

代码。那个架构并不支持

原生的16个字节是sparc的两倍。


如果你的帖子的目的只是为了宣传

这个事实已被授予,但请不要责怪

编译器。他们不能用硬件给你什么

硬件不支持。


lcc-win32支持软件

浮点精度非常高。我认为

而不是16字节双打,350位会使

真正产生差异。性能适用于软件实现,但不要指望硬件速度。


gcc也支持10字节双倍,而gmp(他们的

multiprecision软件包)是一种高速实现。



" bq" < FO ********** @ yahoo.com>在消息中写道

news:6c ************************** @ posting.google.c om ...

关于浮点支持的两个问题:

wintel(MS Windows + x86)平台的C编译器到目前为止符合C99
as< math.h>和< tgmath.h>关心?


这是一个图书馆问题。如果你将我们的库添加到几个

编译器(VC ++,Comeau,mingw)中的任何一个,你可以得到一个wintel编译器,

正确支持这些头文件。

wintel编译器支持16字节长双精度 (精确度为33位十进制数字),包括正确的printf()支持。我找到了一些支持long double的编译器,但是它们是8字节或者10字节或12字节类型,精度与
相同或几乎相同简单的8字节双。



VC ++仅支持8字节长的double(与double相同)。 Comeau有相同的限制,至少在坐在VC ++之上时。 mingw支持

本机英特尔10字节长双,虽然他们的库具有较差的双b&b
长双精度。我们的库支持编译器将处理的最大值b / b
。据我所知,没有wintel编译器支持16字节长
,因为硬件不支持它。


PJ Plauger

Dinkumware,Ltd。
http://www.dinkumware.com


" jacob navia" < JA *** @ jacob.remcomp.fr>在消息新闻中写道:< cb ********** @ news-reader4.wanadoo.fr> ...

" bq" < FO ********** @ yahoo.com> écritdansle message de
新闻:6c ************************** @ posting.google.c om ... < blockquote class =post_quotes>你好,
有关浮点支持的两个问题:

wintel(MS Windows + x86)平台的C编译器符合C99
远至< math.h>和< tgmath.h>有关吗?
lcc-win32。标头可能不符合100%标准,但基本的硬件支持就在那里。

wintel编译器支持16字节long double。 (精确到33位十进制数字),包括正确的printf()支持。



lcc-win32支持10字节长的double。如果这对你来说太少了,你可以使用350位浮点。




我不熟悉这种350位模式。

这是通过库函数还是其他一些特殊工具?

如果您的帖子的目的只是为了宣传这个事实,那么,请不要责怪
编译器。




没有责备。实际上编译器+库有16字节

支持

(我不会重复它的名字!)有一些我不喜欢的。示例:

sqrt()函数的操作,如同< tgmath.h>即使在它的时候也包括在内。

不是。

然而,hypot()在double中操作无论其参数类型如何,

并且没有使用hypotl()。我花了一段时间才弄明白为什么

一个例程(SVD计算)正在失去精度。一旦hypot()

被我自己的例程替换,就恢复了全部精度。


谢谢。

bq

Hello,
Two questions related to floating point support:

What C compilers for the wintel (MS Windows + x86) platform are C99
compliant as far as <math.h> and <tgmath.h> are concerned?

What wintel compilers support a 16-byte "long double" (with 33 decimal
digits of accuracy) including proper printf() support. I found some
compilers that did support "long double", but theirs was an 8-byte or
10-byte or 12-byte type with accuracy the same or nearly the same as
the plain 8-byte "double".

Thanks
fq

Note: My numbers were obtained by "sizeof" and "float.h" macros
DBL_DIGITS and LDBL_DIGITS.

Here is output from OpenWatcom 1.2:
FLT_EPSILON = 1.19209e-007
DBL_EPSILON = 2.22045e-016
LDBL_EPSILON = 2.22045e-016
FLT_DIG = 6
DBL_DIG = 15
LDBL_DIG = 15
FLT_MANT_DIG = 24
DBL_MANT_DIG = 53
LDBL_MANT_DIG = 53

and from Borland 5.5.1:
FLT_EPSILON = 1.19209e-07
DBL_EPSILON = 2.22045e-16
LDBL_EPSILON = 1.0842e-19
FLT_DIG = 6
DBL_DIG = 15
LDBL_DIG = 18
FLT_MANT_DIG = 24
DBL_MANT_DIG = 53
LDBL_MANT_DIG = 64

and, for comparison, from the SUN compiler (on Solaris):
FLT_EPSILON = 1.19209e-07
DBL_EPSILON = 2.22045e-16
LDBL_EPSILON = 1.92593e-34
FLT_DIG = 6
DBL_DIG = 15
LDBL_DIG = 33
FLT_MANT_DIG = 24
DBL_MANT_DIG = 53
LDBL_MANT_DIG = 113

解决方案


"bq" <fo**********@yahoo.com> a écrit dans le message de
news:6c**************************@posting.google.c om...

Hello,
Two questions related to floating point support:

What C compilers for the wintel (MS Windows + x86) platform are C99
compliant as far as <math.h> and <tgmath.h> are concerned?
lcc-win32. The headers may be not in 100% standard compliance, but the basic
hardware support is there.
What wintel compilers support a 16-byte "long double" (with 33 decimal
digits of accuracy) including proper printf() support.
lcc-win32 supports 10 byte long double. If that is too little for
you, you can use 350 bits floating point.

I found some
compilers that did support "long double", but theirs was an 8-byte or
10-byte or 12-byte type with accuracy the same or nearly the same as
the plain 8-byte "double".



No, the accuracy is better, of course, and also the range. As you
know, 64 bit is not the same as 80 bit.

Please be consequent. The "wintel" compilers must generate
code for the intel architecture. That architecture doesn''t support
natively 16 bytes doubles as the sparc does.

If the purpose of your post was just to make publicity
for this fact, granted, but please do not blame the
compilers. They can''t give you in hardware what the
hardware doesn''t support.

lcc-win32 supports software
floating point with very high precision. I thought that
instead of 16 byte doubles, 350 bits would make
a real difference. The performance is good for a software
implementation, but do not expect hardware speeds.

gcc supports 10 byte doubles too, and gmp (their
multiprecision package) is a high speed implementation.



"bq" <fo**********@yahoo.com> wrote in message
news:6c**************************@posting.google.c om...

Two questions related to floating point support:

What C compilers for the wintel (MS Windows + x86) platform are C99
compliant as far as <math.h> and <tgmath.h> are concerned?
This is a library issue. If you add our library to any of several
compilers (VC++, Comeau, mingw) you can get a wintel compiler that
supports these headers properly.
What wintel compilers support a 16-byte "long double" (with 33 decimal
digits of accuracy) including proper printf() support. I found some
compilers that did support "long double", but theirs was an 8-byte or
10-byte or 12-byte type with accuracy the same or nearly the same as
the plain 8-byte "double".



VC++ supports only 8-byte long double (same as double). Comeau has
the same limitation, at least when sitting atop VC++. mingw supports
the native Intel 10-byte long double, though their library has poor
long double precision. Our library supports the maximum of whatever
the compiler will handle. No wintel compiler supports 16-byte long
double, to my knowledge, because the hardware doesn''t support it.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com


"jacob navia" <ja***@jacob.remcomp.fr> wrote in message news:<cb**********@news-reader4.wanadoo.fr>...

"bq" <fo**********@yahoo.com> a écrit dans le message de
news:6c**************************@posting.google.c om...

Hello,
Two questions related to floating point support:

What C compilers for the wintel (MS Windows + x86) platform are C99
compliant as far as <math.h> and <tgmath.h> are concerned?
lcc-win32. The headers may be not in 100% standard compliance, but the basic
hardware support is there.

What wintel compilers support a 16-byte "long double" (with 33 decimal
digits of accuracy) including proper printf() support.



lcc-win32 supports 10 byte long double. If that is too little for
you, you can use 350 bits floating point.



I am not familair with that 350 bit mode.
Is that through library functions or some other special tools?
If the purpose of your post was just to make publicity
for this fact, granted, but please do not blame the
compilers.



No blame was meant. In fact the compiler+library that had 16-byte
support
(I won''t repeat its name!) had a few thins I didn''t like. Example: the
sqrt() function operated as if <tgmath.h> was included even when it
wasn''t.
However, hypot() operated in "double" regardless of its argument type,
and there is no hypotl() to use. It took me a while to figure out why
one routine (an SVD calculation) was losing precision. Once hypot()
was replaced with my own routine, full precision was recovered.

Thanks.
bq


这篇关于Wintel编译器:C99 tgmath.h? 16字节“长双”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆