/* * Copyright (C) 2013 Jeff Epler * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "rtapi.h" #include "vsnprintf.h" #include #include int rtapi_snprintf(char *buf, unsigned long size, const char *fmt, ...) { int retval; va_list ap; va_start(ap, fmt); retval = rtapi_vsnprintf(buf, size, fmt, ap); va_end(ap); return retval; } double vectors[] = { 0.0, -0.0, 3.14, -3.14, 100, 1e6, 1e300, 1e-10, 1e-100, 1e-280, 1e-300, -__builtin_inf(), __builtin_inf(), __builtin_nan(""), }; int nvectors = sizeof(vectors)/sizeof(vectors[0]); #include #include double unow() { struct rusage ru; getrusage(RUSAGE_SELF, &ru); return ru.ru_utime.tv_sec + ru.ru_utime.tv_usec*1e-6; } #define N (1000000) int main(void) { char buf1[1024], buf2[1024]; int i, fail=0; for(i=0; i