←back to thread

218 points signa11 | 2 comments | | HN request time: 0s | source
Show context
siev ◴[] No.43703045[source]
I like the sentiment, I love C. But this book seems riddled with errors and baffling decisions.

First of all, the fixed points are LITERALLY NOT FIXED POINTS. They're decimal floats. Fixed points are just integers that re-scale when multiplied or divided. There is no exponent field, no nothing. The author seems to have confused the notion "fixed points allow for precise calculations of monetary values" to mean that they're decimal. They're not. That section of the book contradicts itself constantly and also the code is wrong.

Also an ordered vector is used to implement a map/set. Because:

> Most people would likely instinctively reach for hash tables, and typically spend the next few months researching optimal hash algorithms and table designs.

> A binary searched vector is as simple as it gets and performs pretty well while being more predictable.

A basic hash table or hash set[1] is both simpler and faster than this solution. And I don't see what's stopping someone from spending the next few months researching optimal dynamic array growth and searching algorithms instead. This line of reasoning just doesn't make any sense.

And "Once nice advantage is that since they don't need any infrastructure, they're comparably cheap to create." What? It needs a dynamic array!

[1] https://github.com/skeeto/scratch/tree/master/set32

replies(3): >>43703760 #>>43704820 #>>43705016 #
codr7 ◴[] No.43704820[source]
Thanks for sharing your opinions, I don't agree.
replies(1): >>43706370 #
chipsa ◴[] No.43706370[source]
The fact you don’t agree is immaterial to the fact that your “fixed point” code doesn’t implement fixed point arithmetic. Fixed point arithmetic has a fixed scale factor for the type, not a value dependent scale factor.
replies(1): >>43707666 #
1. codr7 ◴[] No.43707666[source]
Good luck :)
replies(1): >>43714376 #
2. eqvinox ◴[] No.43714376[source]
Wow, you are incredibly bad at taking criticism. That in itself is reason to dismiss your book; how many other valid points have you ignored like this?