| 1 | /* NUMmachar.c |
| 2 | * |
| 3 | * Copyright (C) 1994-2019 David Weenink |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | /* |
| 20 | djmw 20020812 GPL header |
| 21 | */ |
| 22 | |
| 23 | #include "NUMmachar.h"cxx . . $ `<file>/dwsys/NUMmachar.h`/ |
| 24 | #include "melder.h"cxx . . $ `<file>/melder/melder.h`/ |
| 25 | |
| 26 | #include "NUMlapack.h"cxx . . $ `<file>/dwsys/NUMlapack.h`/ |
| 27 | |
| 28 | static struct structmachar_Tablecxx . . $ structmachar_Table# machar_tablecxx . . $ machar_table.; |
| 29 | |
| 30 | /* |
| 31 | Floating point properties: |
| 32 | |
| 33 | NR LAPACK dlamch |
| 34 | ibeta base 'B' base of the machine |
| 35 | it t 'N' number of (base) digits in the mantissa |
| 36 | machep |
| 37 | eps prec 'P' eps*base ('quantization step') |
| 38 | negep |
| 39 | epsneg eps 'E' relative machine precision ('quantization error') |
| 40 | iexp |
| 41 | minexp emin 'M' minimum exponent before (gradual) underflow |
| 42 | xmin rmin 'U' underflow threshold - base**(emin-1) |
| 43 | maxexp emax 'U' largest exponent before overflow |
| 44 | xmax rmax 'O' overflow threshold - (base**emax)*(1-eps) |
| 45 | irnd rnd 'R' 1 when rounding occurs in addition, 0 otherwise |
| 46 | ngrd |
| 47 | sfmin 'S' safe minimum, such that 1/sfmin does not overflow |
| 48 | */ |
| 49 | |
| 50 | double dlamch_cxx . . $ dlamch_(9a18bdb0e56c1bc2).(const char *cmach); // blas |
| 51 | |
| 52 | void NUMmacharcxx . . $ NUMmachar(49f6e7a06ebc5aa8). () { |
| 53 | if (NUMfppcxx . . $ NUMfpp.) |
| 54 | return; |
| 55 | |
| 56 | NUMfppcxx . . $ NUMfpp. = & machar_tablecxx . . $ machar_table.; |
| 57 | |
| 58 | NUMfppcxx . . $ NUMfpp. -> basecxx . . $ structmachar_Table#base. = (int) NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Base"); |
| 59 | NUMfppcxx . . $ NUMfpp. -> tcxx . . $ structmachar_Table#t. = (int) NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Number of digits in mantissa"); |
| 60 | NUMfppcxx . . $ NUMfpp. -> emincxx . . $ structmachar_Table#emin. = (int) NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Minimum exponent"); |
| 61 | NUMfppcxx . . $ NUMfpp. -> emaxcxx . . $ structmachar_Table#emax. = (int) NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Largest exponent"); |
| 62 | NUMfppcxx . . $ NUMfpp. -> rndcxx . . $ structmachar_Table#rnd. = (int) NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Rounding mode"); |
| 63 | NUMfppcxx . . $ NUMfpp. -> preccxx . . $ structmachar_Table#prec. = NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Precision"); |
| 64 | NUMfppcxx . . $ NUMfpp. -> epscxx . . $ structmachar_Table#eps. = NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Epsilon"); |
| 65 | NUMfppcxx . . $ NUMfpp. -> rmincxx . . $ structmachar_Table#rmin. = NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Underflow threshold"); |
| 66 | NUMfppcxx . . $ NUMfpp. -> sfmincxx . . $ structmachar_Table#sfmin. = NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Safe minimum"); |
| 67 | NUMfppcxx . . $ NUMfpp. -> rmaxcxx . . $ structmachar_Table#rmax. = NUMlapack_dlamch_cxx . . $ NUMlapack_dlamch_(9a18bdb0e56c1bc2). ("Overflow threshold"); |
| 68 | } |
| 69 | |
| 70 | /* End of file NUMmachar.c */ |