by sbierwagen · 3y ago · 0 comments
I've told this story before, but the first time I used sqlite, years ago, I needed to store a floating point value, so I read the documentation: https://www.sqlite.org/datatype3.html
>REAL. The value is a floating point value, stored as an 8-byte IEEE floating point number.
I parsed this as "an 8-bit floating point number". Wow, I thought. That's weird as hell. Oh well, I guess it's sql lite, ha ha. I went on to implement storing numeric values as text strings, which worked exactly as well as you'd expect. Only months later did I find out that it's a normal regular IEEE double, 64 bits long.
It's funny that under "maybe it was an example of nobody reading shit all" there is a comment where someone didn't read the nickname and thought he's answering to the anectdote's poster comment :D
An EE only needs to know that you don't stick your finger in a socket. A mechanical engineer only needs to know that you can't push a rope. And a civil enginer only needs to know that sh*t rolls downhill.
If your code allows it you're fucking doomed anyway and will have multiple other type-related problems all over the codebase.
I was taught to think of a RDMS as the last line of defense against data integrity issues. SQLite, on the other hand, is more than happy to let you shoot yourself in the foot.
I imagine it went went ok!
It can be made to work. I would've gone with Binary-Coded Decimal if IEEE 754 standard isn't precise enough.