I'm sure there's a lot of ways to do this! If you already have the number rounded to the nearest .5, you could just use a TRUNC function in combination with pulling the decimal digit from the variable as an array with '.' as the custom separator, along with a few loops. This is using global variables, so you'd need to switch to local variables or clear them to use it repeatedly.
This also doesn't have any error checking, so it'll fail if you don't have a decimal in the variable, just a quick sketch of one way to approach it.
Stars.kmmacros (6.1 KB)
edit: typo