C语言 stdint.h 的 stdfloat.h 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4114284/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 06:56:00  来源:igfitidea点击:

stdfloat.h version of stdint.h

cmath

提问by GlassGhost

What standard naming conventions and or math libraries do you use? I currently use

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

#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" ??*/

but as you can see I am yet to decide upon a math library.

但正如你所看到的,我还没有决定一个数学库。



原问题: Recommendation for a small math library with Straight forward naming convention.推荐一个具有直接命名约定的小型数学库。

Does anyone know of any small C libraries with straightforward naming conventions? This is what im using right now:

有谁知道任何具有简单命名约定的小型 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;

What do you use??

你用什么??

回答by Bj?rn Pollex

Well, since your question is tagged C++ as well, I am going to suggest Boost.Integer. If you are not interested in C++ solutions, please remove that tag from you question.

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

回答by Flinsch

Which aspects is the library expected to cover? "Straightforward" naming of Data types only? Then just go with your own definitions. If not restricted to data types, you could use nearly any math library as typedefs are just "individualized" names for well known data types ;)

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