Skip to content

Commit

Permalink
switch to scientific notation, AAAAAAPPPPLLLLEEEE!!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesonjlee committed Aug 16, 2018
1 parent 34a3485 commit 308a29d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions yahoo_quotes.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,17 @@ func sanitize(body []byte) []byte {
func float2Str(v float64) string {
unit := ""
switch {
case v > 1000000000.0:
v = v / 1000000000.0
case v > 1.0e12:
v = v / 1.0e12
unit = "T"
case v > 1.0e9:
v = v / 1.0e9
unit = "B"
case v > 1000000.0:
v = v / 1000000.0
case v > 1.0e6:
v = v / 1.0e6
unit = "M"
case v > 1000.0:
v = v / 1000.0
case v > 1.0e5:
v = v / 1.0e3
unit = "K"
default:
unit = ""
Expand Down

0 comments on commit 308a29d

Please sign in to comment.