uutils / coreutils

Cross-platform Rust rewrite of the GNU coreutils
https://uutils.github.io/
MIT License
17.61k stars 1.27k forks source link

seq: add support for parsing hexadecimal floating point inputs #2660

Open jfinkels opened 3 years ago

jfinkels commented 3 years ago

See https://www.gnu.org/software/coreutils/manual/html_node/Floating-point.html#Floating-point

For example,

$ seq -0x.ep-3 -0x.1p-3 -0x.fp-3
-0.109375
-0.117188
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Qelxiros commented 4 months ago

Hello! I started digging into this, and it looks like BigDecimal has some shortcomings. I'd like to use the BigDecimal::from_str_radix() function to parse input (either before or after splitting on p), but that function only allows a radix of 10. I considered some sort of hack to work around this, but at that point I'm just reimplementing what bigdecimal should do. I'm going to look into making a PR to bigdecimal, but failing that/in the meantime, I'd appreciate some guidance here. Thanks!