lcn2 / calc

C-style arbitrary precision calculator
http://www.isthe.com/chongo/tech/comp/calc/index.html
Other
346 stars 52 forks source link

Does `calc` support the `separator`? #77

Closed larryw3i closed 1 year ago

larryw3i commented 1 year ago

Hello, @lcn2 , Does calc support the separator?
Like https://peps.python.org/pep-0515/

calc 123_456_789 + 987_654_321   

Regards, larryw3i

lcn2 commented 1 year ago

Hello, @lcn2 ,

Does calc support the separator?

Like https://peps.python.org/pep-0515/


calc 123_456_789 + 987_654_321   

Regards,

larryw3i

Hello @larryw3i ,

Calc does not support the "separator". Calc numbers are compact.

Sorry.

larryw3i commented 1 year ago

I think this feature should be added to Calc. 😭

lcn2 commented 1 year ago

I think this feature should be added to Calc. 😭

It is an idea you could propose as an enhancement.

However not only would one have to accept constants with 's in them, one would need to allow values to be printed via the calc printf() and related builtin functions as well as the calc scanf() builtin and related builtin functions. One would need to determine how the "printf format" string would indicate use of 's. Then there is a question of come calc config parameter to indicate that the default printing of decal values should include _'s in them.

Someone would have to modify the parser, updater the released builtins, add test code to regress.cal to test the code, and update the help files.