Skip to content

Commit ab4cd87

Browse files
committed
Updated Readme and keywords
1 parent 7aaa4a6 commit ab4cd87

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The number of bits needed under the hood for the types implemented in this libra
1010

1111
This library was original made for [Mozzi](https://sensorium.github.io/Mozzi/).
1212

13+
## Installation
14+
15+
FixMath can be installed from the [Arduino Library Manager](https://www.arduino.cc/reference/en/libraries/fixmath/) or manually by downloading it (button "Code/Download Zip"), uncompressing it into your "libraries" folders and renamming it "FixMath".
16+
1317

1418

1519
## Documentation
@@ -31,8 +35,10 @@ Like standard C(++) types, the fixed point numbers defined here are following so
3135
- Fixed types can be constructed from and converted to standard C types:
3236
- `UFix<NI,NF>(T value)` will convert the `value` to a `UFix`. If T is an integer type the final number will have a fractional part equal to zero. This can be used as a standard type, for example: `UFix<8,8> a = 15;` or `UFix<8,8> b = 200.25;`
3337
- same for `SFix`
34-
- `UFix<NI,NF>::fromRaw(T value)` will set the *internal* value of the `UFix`. For example `UFix<7,1>::fromRaw(16);` is actually 8
38+
- `UFix<NI,NF>::fromRaw(T value)` will set the *internal* value of the `UFix`. For example `UFix<7,1>::fromRaw(16);` is actually 8. `T` has to be an integer type for getting the expected behavior.
3539
- same for `SFix`
40+
- `UFixAuto<const T N>()` will return a `UFix<NI,0>` where `NI` is automatically computed to be the smallest needed to represent the **integer** `N`. For instance: `auto a = UFixAuto<3>();` returns a `UFix<2,0>`. This is determined at compile-time hence `N` has to be a constant
41+
- `SFixAuto<const T N>()` same for `SFix`
3642
- `UFix<NI,NF>.toFloat()` returns the value as a `float`
3743
- same for `SFix`
3844
- `UFix<NI,NF>.asRaw()` returns the internal value
@@ -92,10 +98,10 @@ More specifically on the returned types of the operations between fixed point ma
9298
- `SFix<NI,NF>.asFloat()` returns the value as a `float`
9399
- `UFix<NI,NF>.asRaw()` returns the internal value
94100
- `SFix<NI,NF>.asRaw()` returns the internal value
95-
- `T.toUFraction()` returns `UFix<0,NF>` with `NF` the number of bits of `T` (`uint8_t` leads to `NF=8`bits).
96-
- `T.toSFraction()` returns `SFix<0,NF>` with `NF` the number of bits of `T` (`int8_t` leads to `NF=7`bits).
97-
- `T.toUInt()` returns `UFix<NI,0>` with `NI` the number of bits of `T` (`uint8_t` leads to `NI=8`bits).
98-
- `T.toSInt()` returns `SFix<NI,>` with `NI` the number of bits of `T` (`int8_t` leads to `NI=7`bits).
101+
- `toUFraction(T)` returns `UFix<0,NF>` with `NF` the number of bits of `T` (`uint8_t` leads to `NF=8`bits).
102+
- `toSFraction(T)` returns `SFix<0,NF>` with `NF` the number of bits of `T` (`int8_t` leads to `NF=7`bits).
103+
- `toUInt(T)` returns `UFix<NI,0>` with `NI` the number of bits of `T` (`uint8_t` leads to `NI=8`bits).
104+
- `toSInt(T)` returns `SFix<NI,>` with `NI` the number of bits of `T` (`int8_t` leads to `NI=7`bits).
99105

100106
Note on division:
101107
The division is not implemented. This is a deliberate choice made for two reasons:

keywords.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ sL KEYWORD2
99
invFast KEYWORD2
1010
invAccurate KEYWORD2
1111
inv KEYWORD2
12+
invFull KEYWORD2
1213

1314
asSFix KEYWORD2
1415
asUFix KEYWORD2
@@ -18,3 +19,5 @@ toSFraction KEYWORD2
1819
toUFraction KEYWORD2
1920
toUInt KEYWORD2
2021
toSInt KEYWORD2
22+
UFixAuto KEYWORD2
23+
SFixAuto KEYWORD2

0 commit comments

Comments
 (0)