Is there a way to find numbers which is more or less than certain exponent?

108 views Asked by At

I have a code writes a robot coordination in a file. Sometimes, for an unknown reason, instead of a number like 0.01845, it writes 6.92113e-310. So I'd like to filter data raised to a power greater than -12. Is there a way to achieve this in C++?

1

There are 1 answers

1
MSalters On

Just to help with the math: you get the exponent using std::log10.

This actually returns the exponent as the integer part, and the significand (the 6.9113 before the e) controls the fractional part of log10.

Filtering a collection by a predicate should be in your C++ textbook.