[pmwiki-users] MarkupExprPlus calculating with fractions

Martin Kerz mkerz at me.com
Sat Sep 7 06:44:31 CDT 2013

As a reply to myself. 

In lines 161 to 169:

function MEP_nums($params) {
  $params = preg_split('/\\s+/', $params);
  $args = array();
  foreach($params as $p) {
    list($d) = sscanf($p, "%g");
    if(is_numeric($d)) $args[] = $d;
  return $args;

According to the php manual sscanf() doesn't support th "%g" format and moreover doesn't respect locales either. Changing it to %f or %e doesn't fix the problem, though.

Any ideas?


On 07 Sep, 2013,at 12:05 PM, "Martin Kerz" <mkerz at me.com> wrote:


it seems, that it's not possible to calculate with fractions using MarkupExprPlus. 

I want to do 

(:Sum:{(add {$:U} {$:K})}:)

It works just fine with integers.

Whenever I use a decimal fraction, like 


It produces an error.

Is it possible to modify MarkupExprPlus to calculate these? If not, is anyone aware of another solution? That would be of great help.

Thanks a lot in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20130907/09b94bda/attachment.html>

More information about the pmwiki-users mailing list