JuliaLang/julia

function to change numeric output format

Open

#6 493 ouverte le 10 avr. 2014

Voir sur GitHub
 (24 commentaires) (0 réactions) (0 assignés)Julia (5 773 forks)batch import
REPLdisplay and printinggood first issue

Métriques du dépôt

Stars
 (48 709 stars)
Métriques de merge PR
 (Merge moyen 20j 6h) (157 PRs mergées en 30 j)

Description

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

Guide contributeur