emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Calc: Multiply time (hours) with a float
@ 2016-09-08  8:33 Karl Voit
  2016-09-11 11:45 ` Karl Voit
  0 siblings, 1 reply; 16+ messages in thread
From: Karl Voit @ 2016-09-08  8:33 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I do have following situation: I'd like to multiply a float with hours
which results in an error, obviously. However, I was not able to find
out how to do it.

Minimal example with expected product:

| time [h:m:s] |   value |   product |
|--------------+---------+-----------|
|     09:15:00 | 2.54321 | 23.524693 |
#+TBLFM: @2$3=$2*$1




In case you have time and energy to go deeper in my rabbit hole:


My real world example which is a bit more complex in case you want to
find a totally different way (workaround?) of calculating the stuff I
need:

First table determines the reference hours per day of my lawn mowing
robot with the current program:

#+NAME: robot-program
| Status As Of     | Start |   End | Start |   End | Hours/Day |
|------------------+-------+-------+-------+-------+-----------|
| <2016-06-30 Thu> | 11:30 | 19:30 | 20:30 | 21:45 |  09:15:00 |
#+TBLFM: $6=($3-$2)+($5-$4);T

Second table holds the logged number of hours of work for certain time
stamps (first three columns). The thing I want to calculate is the
number of hours the robot was *supposed* to work. Unfortunately, the
robot gets stuck from time to time and therefore the logged working
hours differ from the theoretical working hours (reference).

For a better understanding, I split the calculation of $6 (my desired
comparison value) and added $4 (the daily hour reference value) and $5
(difference between the current row and the previous one in time).

Current situation with the ERROR:

| Date                   | Hours | Difference [h] | Daily Reference | Difference [Days] | Reference Comparison [h] |
|------------------------+-------+----------------+-----------------+-------------------+--------------------------|
| <2016-08-13 Sat>       |   100 |            100 |                 |                   |                          |
| <2016-08-20 Sat 14:40> |   217 |            117 |        09:15:00 |          7.611111 | #ERROR                   |
| <2016-08-27 Sat 19:08> |   245 |             28 |        09:15:00 |          7.186111 | #ERROR                   |
#+TBLFM: $3=$2-subscr(@<$2..@>$2, @# - 1);N :: @3$4..@>$4=remote(robot-program,@>$6);T :: @3$5..@>$5=($1 - subscr(@<$1..@>$1, @# - 1)) :: @3$6..@>$6= $5 * $4

Desired output:

| Date                   | Hours | Difference [h] | Daily Reference | Difference [Days] | Reference Comparison [h] |
|------------------------+-------+----------------+-----------------+-------------------+--------------------------|
| <2016-08-13 Sat>       |   100 |            100 |                 |                   |                          |
| <2016-08-20 Sat 14:40> |   217 |            117 |        09:15:00 |          7.611111 |                70.402777 |
| <2016-08-27 Sat 19:08> |   245 |             28 |        09:15:00 |          7.186111 |                66.471527 |

Nitpicking: yes, comparing reference*hours (of whole days) to log
values which were logged in-between working hours is not exact even
with zero percent stuck time. I'd like to have just a rough
comparison.

So if my desired output can be derived without multiplying hours to
floats: I'm open ;-)

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-09-20 14:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08  8:33 Calc: Multiply time (hours) with a float Karl Voit
2016-09-11 11:45 ` Karl Voit
2016-09-11 12:12   ` Michael Welle
2016-09-18 16:36     ` Karl Voit
2016-09-19  6:49       ` Michael Welle
2016-09-19  6:55         ` Michael Welle
2016-09-19 11:43           ` Karl Voit
2016-09-19 12:41             ` Michael Welle
2016-09-19 13:18               ` Karl Voit
2016-09-19 13:49                 ` Michael Welle
2016-09-19 15:33                   ` Nick Dokos
2016-09-19 17:45                     ` Michael Welle
2016-09-20 14:17                       ` Karl Voit
2016-09-19 15:33                 ` Bernhard Pröll
2016-09-20 14:23                 ` Calc: Multiply time (hours) with a float - solved by updating Org Karl Voit
2016-09-20 14:58                   ` Michael Welle

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).