开发者

Flex real type definition in scientific and engineering notation in c++

开发者 https://www.devze.com 2023-02-23 12:48 出处:网络
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 fun

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)?

0

精彩评论

暂无评论...
验证码 换一张
取 消