Open
Description
#include <iostream>
#include <ctime>
#include <iomanip>
#include <limits>
#include <cstring>
#include <string>
#include <cassert>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/number.hpp>
using double_type = boost::multiprecision::number<
boost::multiprecision::cpp_dec_float<8>,
boost::multiprecision::et_off
>;
int main() {
double_type value1("99999999.27");
std::cout << "value1 = " << value1 << std::endl; // value1 = 1e+8
double_type value3 = 99999999.27;
std::cout << "value3 = " << value3 << std::endl; // value1 = 1e+8
double_type value2 = 0.0000000007379;
std::cout << "value2 = " << value2 << std::endl;
double_type value4 = 1.23456789123456789; // 大数
std::cout << "value4 = " << value4 << std::endl; // value5 = 1.23457
double_type value5("1.23456789123456789"); // 大数
std::cout << "value5 = " << value5 << std::endl; // value5 = 1.23457
return 0;
}
double_type的定义好像不尽如人意,是有什么与那因吗?
Metadata
Assignees
Labels
No labels
Activity