#pragma once
|
|
//#include <stdio.h>
|
//#include <stdlib.h>
|
//#include <tchar.h>
|
//#include <memory.h>
|
#include "system/base.hpp"
|
#include "xstring.hpp"
|
#include "wobject/xutil.hpp"
|
|
class xdouble
|
{
|
private:
|
double value;
|
public:
|
xdouble(double val = 0) :value(val) {}
|
xdouble(int val) :value((double)val) {}
|
xdouble(xstring val) :value(val.toDouble()) {}
|
public:
|
operator double() { return value; }
|
double toInt() { return (int)value; }
|
xstring toString() { return xstring(value); }
|
double round(int len)
|
{
|
wchar_t format[64] = L"#.";
|
for (int i = 0; i < len && i< 60; i++)
|
{
|
format[2+i] = L'#';
|
}
|
xstring str(value);
|
bool del = false;
|
xstring str1 = xutil::FormatDecimalString((LPTSTR)str.c_str(), format, del);
|
return str1.toDouble();
|
}
|
};
|