SciNim / Unchained

A fully type safe, compile time only units library.
https://scinim.github.io/Unchained
109 stars 0 forks source link

Improve custom `^` macro #31

Closed Vindaar closed 1 year ago

Vindaar commented 1 year ago

Previously this macro was a bit too dumb and only worked for powers >= 2. For smaller and negative values it produced rubbish.

edit: Also makes the string representation use a half-width space between number and unit by default. Can be disabled by compiling with -d:noUnicode, which also disables usage of unicode in the printing of the unit names.

Finally, changes the default behavior of unit printing from long format to short format for more concise output. Use pretty manually to hand short = false if the previous behavior was preferred or compile with -d:ShortFormat=false.