Pxem (rpxem v0.0.7), 0 + 113 = 113 bytes
Golfed off 139-byte answer!
Filename ([\xHH]
means such binary of character)
[\x01].r [\x19]quarter[\x0A]dime[\x05]nickel[\x01]penny._.i6.+.!.i0.-[\x0A].!.+._.+.tA.w.c.m.y.c.m.$.n.m.%.tAB .x.o.c[\x0A].a .oXXx.aAB.x.s.c[\x0A].a.c.a
Try it online!
Input format
Due to rpxem's implementation I had to force fractions part to be exactly two-digit: therefore inputs such as 0.1
have to be fixed to 0.10
.
Explained
Program overall:
[\x01].r
[\x19]quarter[\x0A]dime[\x05]nickel[\x01]penny
._.i6.+.!
.i0.-[\x0A].!.+
._.+.t
A.w
.c.m.y
.c.m.$.n
.m.%.t
AB .x.o.c[\x0A].a .o
XXx.a
AB.x.s.c[\x0A].a
.c.a
Set stack to 25, "quarter", 10, "dime", 5, "nickel", 1, "penny", 0. The last 0 is the sentry:
[\x01].r [\x19]quarter[\x0A]dime[\x05]nickel[\x01]penny
Given a decimal input, multiply 100.
Get integer part and a period (0x2E, which is 46 in decimal). Then multiple the integer with 100 (= 46 (".") + 54 ("6")):
._.i6.+.!
Get one digit as character. Then interpret as a integer to multiple it with 10 to add to result of previous chunk:
.i0.-[\x0A].!.+
Now read the final digit to add to the result of previous chunk. Now store the result to the register.
._.+.t
Loop 1. do { ... } while @stack.pop != 0
:
A.w
.c.m.y.c.m.$.n.m.%.tAB .x.o.c[\x0A].a .oXXx.aAB.x.s.c[\x0A].a
.c.a
Compare coin value and given input as cents. If so, enter the block. Otherwise don't:
.c.m.y
.c.m.$.n.m.%.tAB .x.o.c[\x0A].a .o
XXx.a
Output register divided by coin value:
.c.m.$.n
Update register to register modulo coin value:
.m.%.t
Now top of stack is first character of coin name. Output coin name, with leading and trailing spaces:
AB .x.o.c[\x0A].a .o
Before getting out of the block push "x", which is greater than \x0A
:
XXx.a
Let top of stack to next coin value (or the sentry zero):
AB.x.s.c[\x0A].a
Break the loop if reached to sentry zero (remember .w
):
.c.a
Reached to end of program: program terminates.