code
code copied to clipboard
Suggestion: add some external link(or reference) in the end of each chapter
Take chapter5 I'm reading as example. (MEAP v15)
TBH, in Listing 5.14, I don't know why this is the way to converto from f64 to q7:
impl From<f64> for Q7 {
fn from (n: f64) -> Self {
if n >= 1.0 {
Q7(127)
} else if n <= -1.0 {
Q7(-128)
} else {
Q7((n * 128.0) as i8) // especially here, which confused me, why can't we just use first 7bits in mantissa part of that *f64* number.
}
}
}
Until I'm reading this(full definition): https://en.wikipedia.org/wiki/Q_(number_format) And I finally understand your code. So in this context, if there are some external reference for q7 definition, it can help me to better understand your code. And make user understand more if he/she interests on this.