unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Using Calc unit conversion functions in an Org Spreadsheet
Date: Thu, 16 Nov 2023 08:28:02 +0100	[thread overview]
Message-ID: <87zfze2m4d.fsf@web.de> (raw)
In-Reply-To: 87msvfp9p1.fsf@polaris64.net

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.




  parent reply	other threads:[~2023-11-16  7:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 10:52 Using Calc unit conversion functions in an Org Spreadsheet Simon Pugnet
2023-11-15 16:07 ` Eric S Fraga
2023-11-17  7:32   ` Simon Pugnet
2023-11-16  7:28 ` Michael Heerdegen [this message]
2023-11-17  7:36   ` Simon Pugnet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zfze2m4d.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).