3 * Copyright 2007 Free Software Foundation, Inc.
5 * This program 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 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include <usrp2/strtod_si.h>
26 strtod_si(const char *s, double *result)
31 double r = strtod(s, &endptr);
36 case 'p': r *= 1e-12; break;
37 case 'n': r *= 1e-9; break;
38 case 'u': r *= 1e-6; break;
39 case 'm': r *= 1e-3; break;
40 case 'k': r *= 1e3; break;
41 case 'M': r *= 1e6; break;
42 case 'G': r *= 1e9; break;
43 case 'T': r *= 1e12; break;
45 // ignore. FIXME could be more robust