andandandand andandandand - 1 year ago 134
C++ Question

Regex for numbers on scientific notation?

I'm loading a .obj file that has lines like

vn 8.67548e-017 1 -1.55211e-016

for the vertex normals. How can I detect them and bring them to double notation?

Answer Source

The standard library function strtod handles the exponential component just fine (so does atof, but strtod allows you to differentiate between a failed parse and parsing the value zero).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download