Skip to content

Commit 0cab747

Browse files
authored
Fix metric autoscaling (#92)
1 parent 37c24b9 commit 0cab747

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/cformat.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function format( x::T;
209209
( 1e-6, "μ" ),
210210
( 1e-3, "m" ) ]
211211
for (mag,sym) in smallscales
212-
if abs(x) < mag*10
212+
if abs(x) < mag*1000
213213
x /= mag
214214
suffix = string(sym, suffix)
215215
break

test/cformat.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ end
130130
@test format( 1.2e6, autoscale = :metric ) == "1.2M"
131131
@test format( 1.2e3, autoscale = :metric ) == "1.2k"
132132
@test format( 1.2e-6, autoscale = :metric ) == "1.2μ"
133+
@test format( 1.2e-7, autoscale = :metric ) == "120n"
134+
@test format( 1.2e-8, autoscale = :metric ) == "12n"
133135
@test format( 1.2e-9, autoscale = :metric ) == "1.2n"
134136
@test format( 1.2e-12, autoscale = :metric ) == "1.2p"
135137

0 commit comments

Comments
 (0)