frawk icon indicating copy to clipboard operation
frawk copied to clipboard

arbitrary precision arithmetic

Open beling opened this issue 4 years ago • 2 comments

It's really good to see that great AWK language is not death, and modern implementation is developed. My congratulation!

I used to use AWK a lot, especially to calculate some statistics like sum, mean or standard deviation from data included in text files (usually logs produced by my software). But many time I had to switch to Python, to calculate them accurately. Python has:

  • arbitrary precision integers (useful to sum huge integers without overflowing, and calculate e.g. accurate mean),
  • fsum function (in math module), which is able to sum floats accurately, see https://github.com/python/cpython/blob/d9ab95ff1fe81efdf70e545d536d9f6927d1ba81/Modules/mathmodule.c#L1381 for algorithm (I can also share my Rust implementation),
  • good statistics module.

Please consider adding some of these futures (especially arbitrary precision integers) to frawk.

beling avatar Sep 28 '20 08:09 beling

Hi! Thanks for your interest in frawk. I have been thinking about adding higher or arbitrary-precision arithmetic to frawk. It's a big question with lots of points in the design space. I'm not sure when I'll be able to get to it, but I'll keep this issue open for the time being, and for you listing out the specific use-case you have for going beyond standard operations 64-bit integers and double-precision IEEE floats.

ezrosent avatar Sep 29 '20 03:09 ezrosent

@beling gawk has --bignum.

ghuls avatar Oct 29 '20 22:10 ghuls