Hi Mat

Thanks for the great feedback!!! I guess I overlooked calc on Tobias’ pages 
either because I ran into math.js first and was repelled by it’s complexity 
… or I did not evaluate it further because it is specialised on working 
with field values which I do not need. (But I found out that rpn covers 
this also in a way I would prefer.) I have added it to my alternatives of 
course.

First of all: I like your hint to the term decimals! For me it suggests, 
that a fixed number of digits after the comma would be returned. rpn can’t 
do that (it would be nice to show the exactness of a result). But maybe it 
is just me?

Here are some differences and similarities I found: 

* calc has more functionality (until, beyond, by) – as all solutions by 
Tobias it is very sophisticated, mine is primitive ;–)
* calc unites operator and operand – rpn separates them (this makes my 
macro usage easier)
* calc does not round all numbers the same way – some are rounded up, 
others are floored (see example below)
* calc and rpn both do not return trailing zeros (as one could hope 
specifying parameters like decimals or dacs)
* both can handle values from fields: calc accepts field (and tiddler) 
names, in rpn you can use transclusions

You can copy this in a new tiddler in the calc wiki 
<http://tobibeer.github.io/tb5/#calc> to try yourself: 

<<calc 1 /3 decimals:4>>

<<calc 0 +1.5500 decimals:4>>

<<calc 0 +1.5 decimals:0>> – the 5 in 1.5 is rounded (up)

<<calc 1 +1.555>> – the last 5 is floored

---

calc has 2444 characters, rpn.js has 1305

<<calc 2444 /1305 >>

that is a plus of 87 percent

I am not sure about your last question. For the first I use wikify a lot 
myself – are there any disadvantages I am not aware of?

Second: I guess you are not after this:
<$macrocall $name="rpn" a=<<rpn 2 2 *>> b=<<rpn 2 2 *>> operation="*"/>

rpn expects text as input and interpretes it as a number, wikify is a safe 
way to get text as output from other macros … 

Thanks again and have a nice weekend!

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/77699567-8637-44fa-8e8e-792578f47758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to