vim-crunch icon indicating copy to clipboard operation
vim-crunch copied to clipboard

possible to not use scientific notation

Open pinggit opened this issue 5 years ago • 5 comments

I'd like to see 1234567890 instead of 1.23456789e9. is it possible?

pinggit avatar May 09 '20 18:05 pinggit

You can adjust g:crunch_precision, higher than the default of 6 to something like 15 or 20, and you might get the effect you like. It doesn't disable scientific notation, but it won't be displayed as often.

e.g. put this in your .vimrc

let g:crunch_precision = 15

arecarn avatar May 09 '20 22:05 arecarn

@pinggit did this work for you?

arecarn avatar May 20 '20 16:05 arecarn

hi, thanks for the update. I'll test it out and feedback the result.

On Wed, May 20, 2020 at 12:45 PM Ryan Carney [email protected] wrote:

@pinggit https://github.com/pinggit did this work for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arecarn/vim-crunch/issues/65#issuecomment-631593707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPRSHGMBMUYPFMURFSSD23RSQCMLANCNFSM4M445RTA .

pinggit avatar May 20 '20 17:05 pinggit

it does not work.

12345678 = 1.2345678e7
12345678 + 12345678 = 2.4691356e7

after I set this to 15: g:crunch_precision #15

pinggit avatar May 24 '20 15:05 pinggit

This does indeed not work. In autoload/crunch.vim:vim_eval():659, printf() is called w/ %g, which as per :help printf will print a floating point number, as %f or %e depending on value (e.g. possibly employing scientific notation) as opposed to %f which will print a floating point number as 12.23, inf, -inf or nan. Hence, I propose that a new tunable (e.g. g:crunch_scientific_notation) be introduced to select between %g, %e, or %f, addressing this issue.

lalbornoz avatar Apr 04 '21 12:04 lalbornoz