Use nan for empty fields in Calc formulas
authorMichael Brand <michael.ch.brand@gmail.com>
Fri, 28 Dec 2012 14:03:10 +0000 (15:03 +0100)
committerBastien Guerry <bzg@altern.org>
Sat, 29 Dec 2012 13:33:52 +0000 (14:33 +0100)
commita77442b37ba403fa131e877c7c8dc5167406061a
tree0c75ec794f99bc506a4958c9f0fadfbfdc7e3ec7
parent764315b3fce26de59189b957a8049e299209043a
Use nan for empty fields in Calc formulas

* doc/org.texi (Formula syntax for Calc): Add explanation and example
for empty field.
* lisp/org-table.el (org-table-eval-formula): Use `keep-empty' in more
places.
(org-table-make-reference): Use nan (not a number) for empty fields in
Calc formulas.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
(test-org-table/empty-field): New examples dealing with empty fields.
(test-org-table/copy-field): New ert-deftest with examples dealing with
empty fields.

This makes it possible to write spreadsheet Calc formulas that check
for empty fields:  To sum the first two columns unless one or both
empty:
$3 = if("$1" = "nan" || "$2" = "nan", string(""), $1 + $2); E
doc/org.texi
lisp/org-table.el
testing/lisp/test-org-table.el