$WBCalc - calculate math expression
Availability
$WBCalc is available for use with all WBSP commands.
Syntax
$WBCalc{mathexp}
$WBCalc[mathexp]
Parameters
mathexp - any valid mathematical expression.
Valid operators are:
Operator |
Syntax |
Operation |
+ |
a + b |
sum of two numbers |
- |
a - b |
difference between two numbers |
- |
- a |
negative value of a number |
* |
a * b |
multiply two numbers |
/ |
a / b |
a divided by b |
\ |
a \ b |
integer part of a divided |
% |
a % b |
the remainder of a division |
mod |
a mod b |
the remainder of a division (same as %) |
Valid mathematical functions are:
Operator |
Syntax |
Returns |
sin |
sin(a) |
the sine of an angle |
cos |
cos(a) |
the cosine of an angle |
tan |
tan(a) |
the tangent of an angle |
exp |
exp(a) |
e (the base of natural logarithms) raised to a power |
log |
log(a) |
the logarithm to the base 10 of a number |
ln |
ln(a) |
the natural logarithm of a number |
atn |
atn(a) |
the arctangent of a number |
abs |
abs(a) |
the absolute value of a number |
sgn |
sgn(a) |
the sign of a number |
sqr |
sqr(a) |
the square root of a number |
Returns
The result of a mathematical expression.
Example
<!--
[FormFields]
wb_command=q
wb_basename=biblio.mdb
wb_rcdset=titles
wb_changeHFon=[Year published]
wb_order=[Year published]
wb_maxrec=$all$
-->
<!--WB_BeginTemplate-->
<html>
<body>
$wbsetv[countbooks|0]
<!--WB_BeginDetail-->
<!--WB_BeginHeader-->
<strong>This is the list of titles for year $wbf[year published]</strong><br>
<!--WB_EndHeader-->
$wbf[title] - $wbf[isbn]<br>
$wbsetv[
countbooks
|
$wbcalc[$wbgetv[countbooks]+1]
]
<!--WB_BeginFooter-->
<hr>
Total books in $wbf[year published]: <strong>$wbgetv[countbooks]</strong><hr><br>
$wbsetv[countbooks|0]
<!--WB_EndFooter-->
<!--WB_EndDetail-->
</body>
</html>
After running this example, total number of books will be displayed at the bottom of
every year:
This is the list of titles for year 1998
Beginning Visual C++ 6 - 186100088X
Microsoft Internet Information Server 4: the Complete Reference - 0078824575
Total books in 1998: 2
This is the list of titles for year 1999
Beginning Java 2 - 1861002238
Apache Server for Windows Little Black Book: The Indispensable Guide to Day-to-Day Apache Server Tips and Techniques - 1576103919
Non-Designer's Scan and Print Book, The - 0201353946
Total books in 1999: 3
This is the list of titles for year 2000
Sams Teach Yourself Macromedia Dreamweaver 4 in 24 Hours - 0672320428
HTML 4 for the World Wide Web: Visual Quickstart Guide - 0201354934
InDesign 1.0/1.5 for Macintosh and Windows: Visual QuickStart Guide - 0201710366
Real World Adobe InDesign 1.5 - 0201354780
Sams Teach Yourself Macromedia Dreamweaver 3 in 24 Hours - 0672318830
www.color - 0823058573
Microsoft SMS Installer - 0072124474
www.type: Effective Typographic Design for the World Wide Web - 0823058603
Photoshop 6 Down and Dirty Tricks - 0967985307
Developer's Workshop to COM and ATL 3.0 - 1556227043
Total books in 2000: 10