LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::anonymous_namespace{rational_representation.cpp} 命名空间参考

函数

std::string format_scaled_decimal (BigInt scaled, std::size_t digits)

函数说明

◆ format_scaled_decimal()

std::string LMCAS::anonymous_namespace{rational_representation.cpp}::format_scaled_decimal ( BigInt scaled,
std::size_t digits )

在文件 rational_representation.cpp 第 11 行定义.

11 {
12 const bool negative = scaled < BigInt(0);
13 if (negative) {
14 scaled = scaled * BigInt(-1);
15 }
16 std::string text = scaled.to_string();
17 if (text.size() <= digits) {
18 text.insert(0, digits - text.size() + 1, '0');
19 }
20 text.insert(text.size() - digits, 1, '.');
21 while (text.back() == '0') {
22 text.pop_back();
23 }
24 if (text.back() == '.') {
25 text.pop_back();
26 }
27 if (negative) {
28 text.insert(text.begin(), '-');
29 }
30 return text;
31}

引用了 format_scaled_decimal().

被这些函数引用 format_scaled_decimal().

函数调用图:
这是这个函数的调用关系图: