Flex real type definition in scientific and engineering notation in c++
I'm defining a real type and I'm using strtod for the exponential way even though is untested and don't really know if it works but more imporantly I would like to know if there is any built in function like strtod for engineering notation and if there isn't,开发者_如何学Python how can I do it?
Thanks in advance, Martin
strtod
understands exponential notation. See, e.g., http://pubs.opengroup.org/onlinepubs/009695399/functions/strtod.html .
How about scanf()
with the %g
or %G
format specifier (depending on whether you use e or E in your numbers)?
精彩评论