arecarn / vim-crunch

A calculator inside Vim
Do What The F*ck You Want To Public License
134 stars 9 forks source link

possible to not use scientific notation #65

Open pinggit opened 4 years ago

pinggit commented 4 years ago

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

arecarn commented 4 years ago

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 commented 4 years ago

@pinggit did this work for you?

pinggit commented 4 years ago

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 notifications@github.com 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 commented 4 years ago

it does not work.

12345678 = 1.2345678e7
12345678 + 12345678 = 2.4691356e7

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

lalbornoz commented 3 years ago

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.