Files
mu808/examples/compound.mu8a
T
2025-04-22 20:02:27 +03:00

14 lines
697 B
Plaintext

; A simple compound interest calculator in MU8A for mu808 VM
; Prompts for the percentage and then for the period, outputs the resulting multiplier
; Created by Luxferre in 2025, released into public domain
set 100 0 1 ; store the constant 100 at loc 1
inp 2 3 0 ; prompt for the percentage into loc 2 and the period into loc 3
div 2 1 4 ; divide the percentage value at loc 2 by the constant at loc 1 into loc 4
set 1 0 5 ; set the loc 5 to 1
fma 5 4 5 ; add the constant at loc 5 to the value at loc 4 into loc 5
nel 1 5 5 ; replace loc 5 with its ln
fma 0 3 5 ; replace loc 5 with loc 3 * ln loc 5
nel 0 5 5 ; replace loc 4 with its nexp
out 5 5 0 ; output the resulting value