We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e07a0b9 commit 8851961Copy full SHA for 8851961
3 files changed
base/ryu/exp.jl
@@ -19,7 +19,7 @@ function writeexp(buf, pos, v::T,
19
end
20
buf[pos] = UInt8('0')
21
pos += 1
22
- if precision > 0
+ if precision > 0 && !trimtrailingzeros
23
buf[pos] = decchar
24
25
for _ = 1:precision
base/ryu/fixed.jl
@@ -19,12 +19,9 @@ function writefixed(buf, pos, v::T,
- if trimtrailingzeros
26
- precision = 1
27
- end
28
29
30
test/ryu.jl
@@ -544,6 +544,11 @@ end # Float16
544
@test Ryu.writefixed(7.018232e-82, 6) == "0.000000"
545
546
547
+ @testset "Consistency of trimtrailingzeros" begin
548
+ @test Ryu.writefixed(0.0, 1, false, false, false, UInt8('.'), true) == "0"
549
+ @test Ryu.writefixed(1.0, 1, false, false, false, UInt8('.'), true) == "1"
550
+ @test Ryu.writefixed(2.0, 1, false, false, false, UInt8('.'), true) == "2"
551
+ end
552
end # fixed
553
554
@testset "Ryu.writeexp" begin
@@ -736,6 +741,12 @@ end
736
741
@test Ryu.writeexp(1e+83, 1) == "1.0e+83"
737
742
738
743
744
+@testset "Consistency of trimtrailingzeros" begin
745
+ @test Ryu.writeexp(0.0, 1, false, false, false, UInt8('e'), UInt8('.'), true) == "0e+00"
746
+ @test Ryu.writeexp(1.0, 1, false, false, false, UInt8('e'), UInt8('.'), true) == "1e+00"
747
+ @test Ryu.writeexp(2.0, 1, false, false, false, UInt8('e'), UInt8('.'), true) == "2e+00"
748
+end
749
+
739
750
end # exp
740
751
752
@testset "compact" begin
0 commit comments