help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Calc unit conversion functions in an Org Spreadsheet


From: Michael Heerdegen
Subject: Re: Using Calc unit conversion functions in an Org Spreadsheet
Date: Thu, 16 Nov 2023 08:28:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Simon Pugnet <simon@polaris64.net> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]