-1

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, how can I do it?

Thanks in advance, Martin

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
d0pe
  • 573
  • 4
  • 9
  • 23

2 Answers2

0

How about scanf() with the %g or %G format specifier (depending on whether you use e or E in your numbers)?

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
0

strtod understands exponential notation. See, e.g., http://pubs.opengroup.org/onlinepubs/009695399/functions/strtod.html .

Gareth McCaughan
  • 19,888
  • 1
  • 41
  • 62