Adding Fractions

Here is a script to add fractions together.

:: Load the plugin
:: Available from
@if not plugin jlcutils plugin /l jlcutils
:: Create environment variables for the fractions
@set frac1=5/8
@set frac2=1/2
:: You need to determine the denominator for the fraction result.
:: I just multiply the denominators of the two fractions to get this.
@set denom=16
:: Do it
@echo Add %frac1 with %frac2
@echo %frac1 = %@formatn[4.4,%@frac2real[%frac1]]
@echo %frac2 = %@formatn[4.4,%@frac2real[%frac2]]
@echo ------------
@set total=%@eval[%@frac2real[%frac1]+%@frac2real[%frac2]]
@echos %@real2frac[%total,%denom]
@echo` ` = %@formatn[4.4,%total]
:: Unload the plugin
@if plugin jlcutils plugin /u jlcutils