Arithmetic evaluation: Difference between revisions

Line 1,509:
|> eval
|> printfn "%d"</lang>
 
=={{header|FBSL}}==
Not only can ExecLine() calculate simple arithmetics but it can also compute and/or execute anything that FBSL proper is able to compute and/or execute using the entire range of intrinsic, user-defined and DLL-imported constants and functions of virtually any complexity. Expression AST's are built internally as part of the general parsing process.
 
'''One-liner maths evaluator solution:'''
<lang qbasic>#APPTYPE CONSOLE
 
DIM buffer AS STRING * 1024
 
SCANF("%s", buffer)
EXECLINE("PRINT "">>> "", " & buffer)
 
PAUSE</lang>
'''Output:'''
<pre>1+2*(3+(4*5+6*7*8)-9)/10+(SIN(PI)+COS(M_TWOPI))/SQRT(M_PI_2)
>>> 71.7978845608029
 
Press any key to continue...</pre>
 
=={{header|Go}}==