lavu/eval: extend if/ifnot functions to accept a third parameter

Add support to an if/else construct, simplify logic in expressions.
This commit is contained in:
Stefano Sabatini
2013-01-23 00:02:36 +01:00
parent 056664ff25
commit 2ed0803c6c
4 changed files with 31 additions and 3 deletions

View File

@@ -205,12 +205,24 @@ Evaluating 'pow(-1,1.23)'
Evaluating 'if(1, 2)'
'if(1, 2)' -> 2.000000
Evaluating 'if(1, 1, 2)'
'if(1, 1, 2)' -> 1.000000
Evaluating 'if(0, 1, 2)'
'if(0, 1, 2)' -> 2.000000
Evaluating 'ifnot(0, 23)'
'ifnot(0, 23)' -> 23.000000
Evaluating 'ifnot(1, NaN) + if(0, 1)'
'ifnot(1, NaN) + if(0, 1)' -> 0.000000
Evaluating 'ifnot(1, 1, 2)'
'ifnot(1, 1, 2)' -> 2.000000
Evaluating 'ifnot(0, 1, 2)'
'ifnot(0, 1, 2)' -> 1.000000
Evaluating 'taylor(1, 1)'
'taylor(1, 1)' -> 2.718282