diku-dk / futhark

:boom::computer::boom: A data-parallel functional programming language
http://futhark-lang.org
ISC License
2.37k stars 164 forks source link

Feature request: the trace attribute should support scientific notation #2166

Open patrick-nicodemus opened 2 months ago

patrick-nicodemus commented 2 months ago

If my variable is less than 10^-8 or so, then the #[trace] attribute just prints:

common.fut:182:20-37: 0.000000

It would be helpful if it was available in scientific notation. I would like to see the value of the number out to so many significant digits. At the least I would like to know whether the value is zero.

FluxusMagna commented 2 months ago

This reminds me of #1567, although in that case it was eventually suggested to use a command for the repl and futhark literate instead of an attribute. I do think it makes sense to have a formatted trace though.

athas commented 2 months ago

And it should probably be the same formatting language. The #[trace] attribute is a little trickier, because we need to generate C code for it.