9

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.


Original Question: 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:

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??

9
  • 11
    is <stdint.h> unavailable on your platform?
    – Christoph
    Commented Nov 6, 2010 at 17:48
  • 4
    I use IMPLICIT DOUBLE PRECISION (A-H,O-Z). :-) It's a joke, dont burn me.
    – Anycorn
    Commented Nov 6, 2010 at 17:53
  • 1
    what do you need more about floating point types, then the standard provides? There are float, double and C99 also has long double. Commented Nov 6, 2010 at 19:34
  • 7
    IEEE 754 specifies exact sizes, formats, and results for floating point types and arithmetic. Anything except very obscure and broken platforms will be adhering too (or at least trying to adhere to, with minor mistakes) the IEEE standard. Unless you're working with obscure ancient mainframes or perhaps a small number of obscure non-conformant DSPs, float is 32 bits and double is 64 bits, in the standard formats. And if they're not, you have no way of getting standard floating point types except writing your own soft float library. Commented Nov 7, 2010 at 12:28
  • 9
    Personally, I'd like to make sure the size is specified, so I agree with the poster. The 'float', 'double', 'long double' isn't enough for me. 'long double' can be anything. I want to specify float128_t, NOT long double, which can be 96 bit, 80 bit or whatever the compiler chooses. If we should not have those size specifiers, then we might as well go back to using int, short and char.
    – user1985657
    Commented Dec 16, 2013 at 19:32

0

Browse other questions tagged or ask your own question.