238 {
239 if (!str) {
240 if (endptr) {
241 *endptr = const_cast<char*>(str);
242 }
243 return 0.0;
244 }
245
246 const char* p = str;
248 bool negative = false;
249
250
251 while (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r' || *p == '\f' || *p == '\v') {
252 p++;
253 }
254
255
256 if (*p == '-') {
257 negative = true;
258 p++;
259 } else if (*p == '+') {
260 p++;
261 }
262
263 const char* start = p;
264
265
266 while (*p >= '0' && *p <= '9') {
268 p++;
269 }
270
271
272 if (*p == '.') {
273 p++;
274 double fraction = 0.1;
275 while (*p >= '0' && *p <= '9') {
276 result += (*p -
'0') * fraction;
277 fraction *= 0.1;
278 p++;
279 }
280 }
281
282
283 if (*p == 'e' || *p == 'E') {
284 p++;
285 bool expNegative = false;
286 if (*p == '-') {
287 expNegative = true;
288 p++;
289 } else if (*p == '+') {
290 p++;
291 }
292
294 while (*p >= '0' && *p <= '9') {
295 exp =
exp * 10 + (*p -
'0');
296 p++;
297 }
298
299 double multiplier = 1.0;
300 for (
int i = 0; i <
exp; i++) {
301 multiplier *= 10.0;
302 }
303
304 if (expNegative) {
306 } else {
308 }
309 }
310
311
312 if (endptr) {
313 if (p == start) {
314 *endptr = const_cast<char*>(str);
315 } else {
316 *endptr = const_cast<char*>(p);
317 }
318 }
319
321}
expected< T, E > result
Alias for expected (Rust-style naming)
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT