File: readme.strtod

package info (click to toggle)
avr-libc 1%3A1.2.3-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,816 kB
  • ctags: 14,018
  • sloc: ansic: 17,998; asm: 5,024; sh: 2,778; makefile: 712; pascal: 441
file content (52 lines) | stat: -rw-r--r-- 1,723 bytes parent folder | download | duplicates (2)
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
/* ----------------------------------------------------------------------------------------------

  strtod.s

  Copyright (c) Michael Stumpf   <mistumpf@de.pepperl-fuchs.com>

  addition to Floating point library for Atmel AVR uC
  converts a string to a double ( = float)
  double := [ws]*[+|-][0123456789]*[.0123456789]*[e|E][+|-][0123456789]*

  Author : Michael Stumpf
           mistumpf@de.pepperl-fuchs.com


  Version : 0.1.0

  Date : 17.09.1999

  Algorithm:
              -0123456789.01234567e+012
              converted to

              unsigned long integer fraction :
                ul = 1234567890 (=0x49 96 02 D2) with
              (max 4 byte, breaks if uppermost nibble != 0)
                fraction power (rFracPower) = 9 and
                decimal point shift (rDPshift) = -1

              integer exponent : rExp = 12 rDPshift-1

              then if no overflow/underflow occurs the fp number is
              (corrected by decimal point shift)
                fp = (float)ul * 10^(rExp+rDPshift)

              overflow occurs if exp>0 && exp+fraction power > 38
              or
              fp results in NaN
                fp = +/-MAX_FLT then, errno = ERANGE (if __ERRNO__ is defined)

              underflow occurs if exp<0 && |exp|-fraction power > 38
              or
              fp results in zero and exp<0 && |exp|-fraction power > 38
                fp = 0.0 then, errno = ERANGE (if __ERRNO__ is defined)

  Exceptions: no NAN INF IND strings are recognized

 ================================================================================
  Version Date         Changes
  0.1.0                * first release
  0.1.1   02.11.99     * macro mask(bit) replaced by BV(bit)