-
-
Save lizmat/42d59853c1dfe1f3df35e379b7043efc to your computer and use it in GitHub Desktop.
simple scientific notation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub simple-science($value) { | |
my ($counter,$multiplier) = $value.fmt("%e").split("e"); | |
$counter.subst(/ 0+ $/) | |
~ ' x 10' | |
~ $multiplier.subst(/^ . <( 0+ /).trans('+-0123456789' => '⁺⁻⁰¹²³⁴⁵⁶⁷⁸⁹'); | |
} | |
dd simple-science(.42); | |
dd simple-science(42); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment