File: dtostrf-minmax.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 (56 lines) | stat: -rw-r--r-- 1,635 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Min and max float values.
   $Id: dtostrf-minmax.c,v 1.1 2007/02/06 12:36:58 dmix Exp $
 */
#include <stdlib.h>
#include <string.h>
#include "progmem.h"

#define PATTERN_SIZE	50
#include "dtostrf.h"

PROGMEM static const struct dtostrf_s t[] = {

    { { 0x00800000 }, 0, 45,
	"0.000000000000000000000000000000000000011754944"	},
    { { 0x00800000 }, 0, 44,
	"0.00000000000000000000000000000000000001175494"	},
    { { 0x00800000 }, 0, 43,
	"0.0000000000000000000000000000000000000117549"	},
    { { 0x00800000 }, 0, 42,
	"0.000000000000000000000000000000000000011755"	},
    { { 0x00800000 }, 0, 41,
	"0.00000000000000000000000000000000000001175"	},
    { { 0x00800000 }, 0, 40,
	"0.0000000000000000000000000000000000000118"	},
    { { 0x00800000 }, 0, 39,
	"0.000000000000000000000000000000000000012"	},
    { { 0x00800000 }, 0, 38,
	"0.00000000000000000000000000000000000001"	},
    { { 0x00800000 }, 0, 37,
	"0.0000000000000000000000000000000000000"	},
    { { 0x00800000 }, 0, 36,
	"0.000000000000000000000000000000000000"	},

    { { 0x80800000 }, 0, 45,
	"-0.000000000000000000000000000000000000011754944"	},
    { { 0x00800000 }, 49, 45,
	"  0.000000000000000000000000000000000000011754944"	},
    { { 0x80800000 }, 49, 45,
	" -0.000000000000000000000000000000000000011754944"	},

#ifdef	__AVR__		/* Reason: Glibc calculate all digits.	*/
    { { 0x7f7fffff }, 0, 0,
	"340282350000000000000000000000000000000" },
    { { 0xff7fffff }, 0, 0,
	"-340282350000000000000000000000000000000" },
#endif

};

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