Files
spark/src/lib/md/PriceSize.cpp
T

23 lines
467 B
C++

#include "PriceSize.h"
#include "lib/os/os.h"
namespace bts {
namespace md {
IntPrice INT_NAN = IntPrice();
PriceSize NO_MARKET = PriceSize();
int to_exponent(double value) {
if (value == 0 && os::is_nan(value)) return 0;
char dest[64];
int len = sprintf(dest, "%.10f", value - long(value));
--len; // skip trailing null
while (dest[len] == '0') len--;
if (len == 1) {
return ceil(log10(value));
}
return -(len - 1);
}
}}//namespace