1 For floating point operations, Gnumeric uses the C type gnm_float.
2 Currently that is "double" or "long double", depending on whether
3 Gnumeric was configured with --with-long-double.
5 This has some coding style consequences...
7 1. Don't use (say) "exp"; use "gnm_exp". If you simply use "exp",
8 the argument will be cast from gnm_float to double, thus potentially
9 losing precision and the answer will also have reduced range and
12 2. For exact, fractional constants, use GNM_const(273.18). That will
13 expand to either "273.18" or "273.18L", i.e., a constant with the
14 right precision. Don't bother for fractions that are a power of 2,
15 i.e., for 232.25. Also, don't bother for constants that aren't
16 exact to begin with. Note: make very sure you have a decimal point
17 or an "e" in the argument to GNM_const.
19 Use GNM_const also for huge numbers, e.g., GNM_const (1e100).
21 3. Various <float.h> constants have "gnum" counterparts. See numbers.h.
22 For example, GNUM_DIG.
24 4. Various <math.h> constants have "gnum" counterparts. See mathfunc.h.
25 For example, M_PIgnum and M_LN2gnum.
27 5. To print gnm_float use one of the formats GNUM_FORMAT_f,
28 GNUM_FORMAT_g, ... defined in numbers.h
30 -----------------------------------------------------------------------------
33 ---------------------------------------------------
34 gnm_log (1+x) gnm_log1p (x)
35 gnm_log (1-x) gnm_log1p (-x)
36 gnm_exp (x * gnm_log (y)) gnm_pow (y, x)
37 gnm_exp (x) - 1 gnm_expm1 (x)
38 1 - gnm_exp (x) -gnm_expm1 (x)
39 gnm_pow (1+x,y) pow1p (x,y)
40 gnm_pow (1+x,y) - 1 pow1pm1 (x,y)