probcomp / metaprob

An embedded language for probabilistic programming and meta-programming.
GNU General Public License v3.0
168 stars 17 forks source link

Use special logic for rendering floating-point values in trace diagrams #70

Closed alex-lew closed 6 years ago

alex-lew commented 6 years ago

This very small PR addresses an issue Ulli brought up: in trace diagrams, floating-point numbers often overflow their boxes. He is using a trace diagram generated by Metaprob in his slides, so wanted this cleaned up.

This PR achieves this by using (format "%f" ...), which truncates its output, if the value being rendered is a float, and using (pr-str ...) (as we did before) otherwise.