Overview
Comment: | Simplified balance to human readable handling to only deal with two units -- Nano and raw |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
dd09cf79e5a64d9dbc1076a5ad4624d7 |
User & Date: | rkeene on 2018-07-11 17:04:07 |
Other Links: | manifest | tags |
Context
2018-07-11
| ||
17:23 | Added a complete block generation cycle test check-in: 33f9a7b27a user: rkeene tags: trunk | |
17:04 | Simplified balance to human readable handling to only deal with two units -- Nano and raw check-in: dd09cf79e5 user: rkeene tags: trunk | |
16:52 | Corrected link to manual check-in: ea4f944294 user: rkeene tags: trunk | |
Changes
Modified nano.tcl from [7620b741b7] to [bd38f11c13].
︙ | ︙ | |||
1281 1282 1283 1284 1285 1286 1287 | } proc ::nano::balance::toHuman {raw {decimals 3}} { set humanUnit [normalizeUnitName _USER] set humanUnitMultiplier [dict get $::nano::balance::_conversion $humanUnit] if {$raw > [expr {$humanUnitMultiplier / 10000000}]} { | < < < < < < < < | | < < | < < | < < | < | | | 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | } proc ::nano::balance::toHuman {raw {decimals 3}} { set humanUnit [normalizeUnitName _USER] set humanUnitMultiplier [dict get $::nano::balance::_conversion $humanUnit] if {$raw > [expr {$humanUnitMultiplier / 10000000}]} { set baseUnit $humanUnit } else { set baseUnit "raw" } set balance [toUnit $raw $baseUnit $decimals] set work [split $balance "."] set leading [lindex $work 0] set trailing [string trimright [lindex $work 1] "0"] set balance [join [list $leading $trailing] "."] set balance [string trimright $balance "."] set result [list $balance $baseUnit] return $result } |