4 ms·
I think recently I had to make my own because strtod was too large for my embedded system. I just wanted simple xx.yy type strings, so it was as easy as parsing
by Neywiny 2y ago
I think recently I had to make my own because strtod was too large for my embedded system. I just wanted simple xx.yy type strings, so it was as easy as parsing 2 integers, convert, divide, add, done. I often wish these functions had more variants for stuff like that.
- nly 2y agoParsing decimal strings to double in that way will produce the wrong bit value in many cases.
- Neywiny 2y agoI just needed simple values. It worked fine for me. I should've fuzzed it to check, but really I think all I needed was 1-2 decimal places.
- yjftsjthsd-h 2y agoIf it's only 2 decimals, surely you could trivially test every single possible input? I think of fuzzing as random, but that's a specific optimization that you might not need.
- Neywiny 2y agoI very much could have if I cared, yes. I really right then end up using the code at the end of the day, so it doesn't matter