fend icon indicating copy to clipboard operation
fend copied to clipboard

Scientific notation in output

Open MalteT opened this issue 3 years ago • 3 comments

Allow configuration of the output format (as done with to exact/20dp/etc) but for scientific notation.

This might be possible already, but I can't figure out how to do this.

We might also allow for other notations, like those mentioned in the above Wikipedia article. I would be willing to put some work into this.

Thank You!

MalteT avatar Dec 16 '21 12:12 MalteT

Thanks for raising this issue! Yeah, scientific notation is not currently supported as an output format, but I agree it’d be a really nice feature to have.

Unfortunately the whole formatting part of the code is quite a mess, but if do you feel up to implementing this I’d be super grateful :)

printfn avatar Dec 16 '21 17:12 printfn

Nice! Well, I've looked through the code and found BigRat::format_as_decimal, but there's a lot more for me to comprehend. I might continue this journey when I have more time at hand. I haven't seen enough code to understand how the formatting code could be simplified, but yeah, it's quite complex :D

MalteT avatar Dec 17 '21 10:12 MalteT

Scientific notation would be very useful, I think it should follow the usual convention 1.234E12, perhaps even with an option to write it as 1.234*10^12

There should also be an option to set the number of significant digits, usually only 3 are relevant (4, if the first digit is a 1, as in the example above).

timokoesters avatar Mar 28 '24 22:03 timokoesters