File: dtostre-nans.c

package info (click to toggle)
avr-libc 1%3A1.6.2.cvs20080610-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 14,848 kB
  • ctags: 55,619
  • sloc: ansic: 92,267; asm: 6,692; sh: 4,131; makefile: 2,481; python: 976; pascal: 426; perl: 116
file content (40 lines) | stat: -rw-r--r-- 1,296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* $Id: dtostre-nans.c,v 1.1 2007/02/06 12:36:58 dmix Exp $ */

#include <stdlib.h>
#include <string.h>
#include "progmem.h"
#include "dtostre.h"

PROGMEM static const struct dtostre_s t[] = {

    { { 0x7f800000 }, 0, 0,			"inf" },
    { { 0x7f800000 }, 0, DTOSTR_ALWAYS_SIGN,	" inf" },
    { { 0x7f800000 }, 0, DTOSTR_PLUS_SIGN,	"+inf" },
    { { 0x7f800000 }, 0, DTOSTR_UPPERCASE,	"INF" },
    { { 0xff800000 }, 0, 0,			"-inf" },
    { { 0xff800000 }, 0, DTOSTR_ALWAYS_SIGN,	"-inf" },
    { { 0xff800000 }, 0, DTOSTR_PLUS_SIGN,	"-inf" },
    { { 0xff800000 }, 0, DTOSTR_UPPERCASE,	"-INF" },

    { { 0x7f800001 }, 0, 0,			"nan" },
    { { 0x7f800001 }, 0, DTOSTR_ALWAYS_SIGN,	" nan" },
    { { 0x7f800001 }, 0, DTOSTR_PLUS_SIGN,	"+nan" },
    { { 0x7f800001 }, 0, DTOSTR_UPPERCASE,	"NAN" },
    { { 0xff800001 }, 0, 0,			"nan" },    /* no '-NaN' */
    { { 0xff800001 }, 0, DTOSTR_ALWAYS_SIGN,	" nan" },
    { { 0xff800001 }, 0, DTOSTR_PLUS_SIGN,	"+nan" },
    { { 0xff800001 }, 0, DTOSTR_UPPERCASE,	"NAN" },

    { { 0x7fffffff }, 0, 0,			"nan" },
    { { 0xffffffff }, 0, 0,			"nan" },
    { { 0x7fc00000 }, 0, 0,			"nan" },
    { { 0xffc00000 }, 0, 0,			"nan" },
};

int main ()
{
    int i;
    for (i= 0; (size_t)i != sizeof(t)/sizeof(t[0]); i++)
	run_dtostre (t+i, i+1);
    return 0;
}