Hi all After seeing some interest and other applications (Mat’s GRAPHS) using my little plugin for calculations, I showed my little pony some new tricks.
Besides much better structured code in JS I am especially content with wikification of input (operands) and output (concatenated text) as well as number formatting using locale standard (see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString for more info). Here is in short what rpn can do for you in version 0.6.2: === rpn is a lightweight Javascript macro for basic math operations in TiddlyWiki. It is inspired by formerly popular calculators using Reverse Polish Notation (see Wikipedia <https://en.wikipedia.org/wiki/Reverse_Polish_notation> for more info). <<rpn 50 2.5 * 2 p>> output: 125.00 - takes two operands (*a* and *b*) as input – this may be macros or transclusions - operands are sent through a simplified wikify <http://tiddlywiki.com/#WikifyWidget> function before calculation starts - use *pi* to get π (Math.PI) - basic operations: +, -, /, * - advanced operations: modulus (%) and rounding (optional: Math.floor or Math.ceil) - output formatting - limit digits after comma (*decimals*), force *precision* display with *precision:"p"* (.toPrecision) - *locale* formatting (.toLocaleString) - string concatenation (&) - the resulting string is sent through the internal wikify <http://tiddlywiki.com/#WikifyWidget> function - random numbers in a range from a to b with *precision:"r"* (including both a and b) Installation The plugin available on https://tid.li/tw5/plugins.html includes some documentation. Additional test and demos are on https://tid.li/tw5/hacks.html#rpnTest. === As always: Make a backup first and let me know how it goes. Suggestions for optimisations are always welcome but might need some time. Happy calculations, Thomas -- 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/31e195c4-42bb-4517-ab29-0557c9ca37c8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

