JuliaLang/julia

function to change numeric output format

Open

#6493 aperta il 10 apr 2014

Vedi su GitHub
 (24 commenti) (0 reazioni) (0 assegnatari)Julia (5773 fork)batch import
REPLdisplay and printinggood first issue

Metriche repository

Star
 (48.709 star)
Metriche merge PR
 (Merge medio 20g 6h) (157 PR mergiate in 30 g)

Descrizione

I want change output format for numbers (stand alone floats, float matrix, BigFloats). I can do it in IPython by using %precision magic function. I didn't find any equivalent in Julia.

I know that I can use round but it actually returns different number. It's also cumbersome to convert arrays with combination map + round. One another problem: I didn't get how to change real or output precision of BigFloat: set_bigfloat_precision changes precision for all new BigFloats, copy and deepcopy don't help (they copy value irrespective of new default BigFloat precision), naive precision change via BigFloat.prec corrupts it.

I know, that I handle lot's of different topics in this question and I as a programmer understand that lot's of difficulties lays in output formats. But my friend, mathematician asked me: "Why can I just type %precision in my IPython notebook but not in Julia? Isn't output format change essential feature?".

Guida contributor