JuliaLang/julia

function to change numeric output format

Open

#6,493 建立於 2014年4月10日

在 GitHub 查看
 (24 留言) (0 反應) (0 負責人)Julia (48,709 star) (5,773 fork)batch import
REPLdisplay and printinggood first issue

描述

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?".

貢獻者指南

function to change numeric output format · JuliaLang/julia#6493 | Good First Issue