Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
青柠老师
excelize
提交
f753e560
excelize
项目概览
青柠老师
/
excelize
与 Fork 源项目一致
Fork自
xuri / excelize
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
excelize
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f753e560
编写于
11月 04, 2023
作者:
M
magicrabbit
提交者:
GitHub
11月 04, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix number format scientific notation zero fill issues (#1710)
上级
4e936daf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
4 deletion
+5
-4
numfmt.go
numfmt.go
+3
-4
numfmt_test.go
numfmt_test.go
+2
-0
未找到文件。
numfmt.go
浏览文件 @
f753e560
...
...
@@ -4953,7 +4953,7 @@ func (nf *numberFormat) numberHandler() string {
fracLen
=
nf
.
fracPadding
}
if
isNum
,
precision
,
decimal
:=
isNumeric
(
nf
.
value
);
isNum
{
if
precision
>
15
&&
intLen
+
fracLen
>
15
{
if
precision
>
15
&&
intLen
+
fracLen
>
15
&&
!
nf
.
useScientificNotation
{
return
nf
.
printNumberLiteral
(
nf
.
printBigNumber
(
decimal
,
fracLen
))
}
}
...
...
@@ -4961,14 +4961,13 @@ func (nf *numberFormat) numberHandler() string {
if
fracLen
>
0
{
paddingLen
++
}
f
lag
:=
"f"
f
mtCode
:=
fmt
.
Sprintf
(
"%%0%d.%df%s"
,
paddingLen
,
fracLen
,
strings
.
Repeat
(
"%%"
,
nf
.
percent
))
if
nf
.
useScientificNotation
{
if
nf
.
expBaseLen
!=
2
{
return
nf
.
value
}
f
lag
=
"E"
f
mtCode
=
fmt
.
Sprintf
(
"%%.%dE%s"
,
fracLen
,
strings
.
Repeat
(
"%%"
,
nf
.
percent
))
}
fmtCode
:=
fmt
.
Sprintf
(
"%%0%d.%d%s%s"
,
paddingLen
,
fracLen
,
flag
,
strings
.
Repeat
(
"%%"
,
nf
.
percent
))
if
nf
.
percent
>
0
{
num
*=
math
.
Pow
(
100
,
float64
(
nf
.
percent
))
}
...
...
numfmt_test.go
浏览文件 @
f753e560
...
...
@@ -3539,6 +3539,8 @@ func TestNumFmt(t *testing.T) {
{
"8.8888666665555493e+19"
,
"#,000.00"
,
"88,888,666,665,555,500,000.00"
},
{
"8.8888666665555493e+19"
,
"0.00000"
,
"88888666665555500000.00000"
},
{
"37947.7500001"
,
"0.00000000E+00"
,
"3.79477500E+04"
},
{
"2312312321.1231198"
,
"0.00E+00"
,
"2.31E+09"
},
{
"3.2234623764278598E+33"
,
"0.00E+00"
,
"3.22E+33"
},
{
"1.234E-16"
,
"0.00000000000000000000"
,
"0.00000000000000012340"
},
{
"1.234E-16"
,
"0.000000000000000000"
,
"0.000000000000000123"
},
{
"1.234E-16"
,
"0.000000000000000000%"
,
"0.000000000000012340%"
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录