2010-11-06 37 views
7

您使用什么标准命名约定和/或数学库?我目前使用stdfint.h.h stdint.h的版本

#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; 

你用什么?

+10

是''在您的平台上不可用? – Christoph 2010-11-06 17:48:41

+2

我使用'隐式双精度(A-H,O-Z)'。 :-)这是一个笑话,不要烧我。 – Anycorn 2010-11-06 17:53:23

+0

@Christoph好吧,是的,但现在我该怎么做漂浮? – GlassGhost 2010-11-06 18:36:46

回答

2

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

+1

@Glass:你的前提是错误的,它不能使用C它不是超集,它是一种不同的语言。 – GManNickG 2010-11-23 20:57:37

-1

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