File: bug-21906-scanf_flt.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 (18 lines) | stat: -rw-r--r-- 381 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* bug #21906: scanf: float conversion, wrong width count in case of sign 
   or exponent
   $Id: bug-21906-scanf_flt.c,v 1.1.2.2 2008/02/23 09:03:53 dmix Exp $	*/

#include <stdio.h>

int main ()
{
    float x = 0;

    sscanf ("+1.2599", "%5e", &x);
    if (x != 1.25) return __LINE__;
    
    sscanf ("2.5e+11", "%6e", &x);
    if (x != 25.0) return __LINE__;

    return 0;
}