Skip to content

Latest commit

 

History

History
105 lines (73 loc) · 2.49 KB

format.md

File metadata and controls

105 lines (73 loc) · 2.49 KB

Value format string syntax

Multibit values can have formated value labels.

Grammar for

label_format ::= ["%" format_spec]
format_spec  ::= [sign] base
sign         ::= "s" | "u"
base         ::= "b" | "o" | "d" | "h"

sign

"+" indicates that a sign should be used for both positive as well as negative numbers.
"-" indicates that a sign should be used only for negative numbers.

alignment

"<" Forces the field to be left-aligned within the available space.
">" Forces the field to be right-aligned within the available space.
"^" Forces the field to be centered within the available space.

base

b   base 2
o   base 8
d   base 10
h   base 16, lower-case letters a-f
A   ASCII char string

zero / sign extension

A = 0x0723; B = 0xFF05

format base signed A A3 A2 A1 B B3 B2 B1
%b 2 11100100011 …11 …1 1111111100000101 …11 …1
%o 8 3443 …43 …3 177405 …05 …5
%d 10 1827 …27 …7 65285 …85 …5
%h 16 723 723 …3 ff05 …05 …5
%sb 2 v 11100100011 …11 + + -11111011 -…1 - -
%so 8 v 3443 …43 + + -373 -…2 - -
%sd 10 v 1827 …27 + + -251 -…1 - -
%sh 16 v 723 723 + + -fb -fb - -

other

  • decode floating point numbers
  • decode vectors of numbers

Floating point

Fortran

.toPrecision
.toExponential
.toFixed

Fixed point

Qf
Qm.f

Complex

Vectors

Libs

https://github.com/adamwdraper/Numeral-js

References