Changeset a35b458 in mainline for uspace/lib/math/generic/log.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/generic/log.c
r3061bc1 ra35b458 55 55 float32_t ret = 0; 56 56 float32_t num = 1; 57 57 58 58 for (unsigned int i = 1; i <= TAYLOR_DEGREE_32; i++) { 59 59 num *= arg; 60 60 61 61 if ((i % 2) == 0) 62 62 ret += num / i; … … 64 64 ret -= num / i; 65 65 } 66 66 67 67 return ret; 68 68 } … … 83 83 float64_t ret = 0; 84 84 float64_t num = 1; 85 85 86 86 for (unsigned int i = 1; i <= TAYLOR_DEGREE_64; i++) { 87 87 num *= arg; 88 88 89 89 if ((i % 2) == 0) 90 90 ret += num / i; … … 92 92 ret -= num / i; 93 93 } 94 94 95 95 return ret; 96 96 } … … 107 107 float32_u m; 108 108 int e; 109 109 110 110 m.val = arg; 111 111 /* … … 118 118 e = m.data.parts.exp - (FLOAT32_BIAS - 1); 119 119 m.data.parts.exp = FLOAT32_BIAS - 1; 120 120 121 121 /* 122 122 * arg = m * 2^e ; log(arg) = log(m) + log(2^e) = … … 137 137 float64_u m; 138 138 int e; 139 139 140 140 m.val = arg; 141 141 142 142 /* 143 143 * Factor arg into m * 2^e where m has exponent -1, … … 149 149 e = m.data.parts.exp - (FLOAT64_BIAS - 1); 150 150 m.data.parts.exp = FLOAT64_BIAS - 1; 151 151 152 152 /* 153 153 * arg = m * 2^e ; log(arg) = log(m) + log(2^e) =
Note:
See TracChangeset
for help on using the changeset viewer.