Michael Heerdegen writes: > Simon Pugnet writes: > >> I found ~math-convert-units~ which seems to do exactly what I need >> however I can't get it to work and it's not documented. Passing a >> string expression such as ~(math-convert-units "45 min" 'hr)~ causes >> the error "Lisp error: (wrong-type-argument number-or-marker-p hr)". > > Hmm - yes, this function expects to be called like this (the example > converts 0.35 hr to 21 min): > > (math-convert-units > '(* (float 35 -1) (var hr var-hr)) > '(var min var-min)) > > ==> (* (float 21 1) (var min var-min)) > > Unless you want to convert your input into the internal format of math > expressions, maybe it is easier to first divide the input by 1hr, then > simplify the (now unitless) result, and continue with that? > > Michael. Thanks Michael, yes I think as you say the easiest way is to remove the units first, then explicitly convert back to the desired units afterwards. Thanks for the explanation of math-convert-units. Once I saw it I became convinced that this was the best way to achieve my goals, but the alternative of using math operations to modify the units seems cleaner. Thanks for your help! Kind regards, Simon