stdint.h的stdfloat.h版本

时间:2010-11-06 17:40:46

标签: c math

您使用哪些标准命名约定和/或数学库?我目前使用

#include <stdint.h>
typedef float  float32_t;
typedef double float64_t;
/*! ISO C99: 7.18 Integer types 8, 16, 32, or 64 bits
intN_t = two’s complement signed integer type with width N, no padding bits.
uintN_t = an unsigned integer type with width N.
floatN_t = N bit IEE 754 float.

        uintN_t             intN_t              floatN_t
bits    unsigned-integer    signed-integer      IEE754 float
8       
16      unsigned short      short               ??"half"
32      unsigned            int                 float
64      unsigned long       long                double
128                                             ?? "Long double" "quad" ??*/

但是你可以看到我还没有决定数学库。

<小时/> 原始问题: 推荐使用直接命名约定的小型数学库。

有没有人知道任何具有简单命名约定的小型C库?这就是我现在正在使用的:

typedef unsigned short UInt16; typedef short    Int16;
typedef unsigned       UInt32; typedef int      Int32; typedef float  Float32;
typedef unsigned long  UInt64; typedef long int Int64; typedef double Float64;

你用什么?

2 个答案:

答案 0 :(得分:2)

好吧,既然您的问题也被标记为C ++,我将建议Boost.Integer。如果您对C ++解决方案不感兴趣,请从您的问题中删除该标记。

答案 1 :(得分:-1)

图书馆预计涵盖哪些方面?仅仅是“直接”命名数据类型?然后按照自己的定义去做。如果不限于数据类型,您几乎可以使用任何数学库,因为typedef只是众所周知的数据类型的“个性化”名称;)