Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
Float.maxFloat
Float.minFloat
Float.ceil
Float.floor
Float.round
FUNCTION: Lang.abs
Lang.abs
(value)
The
Lang.abs
function returns the absolute value of a specified number. If the number is a floating-point, then an absolute floating-point number is returned. If the number is an integer, then an absolute integer will be returned.
Several functions in the
Float Library
can also be used to manipulate numbers.
The mandatory
value
parameter can be any positive or negative single-precision floating-point number or any positive or negative integer number (including zero). The floating-point number must reside on or between the largest number and the smallest nonzero number supported by the browser. These boundary values can be determined using the
Float.maxFloat
and
Float.minFloat
functions.
Code for AbsExample.wml
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1">
<p>
abs example
</p>
<do type="accept">
<go href="AbsExample.wmls#findabs()" />
</do>
</card>
<card id="card2">
<p>
original number = $(number)
<br />
absolute number = $(absnumber)
</p>
</card>
</wml>
Code for AbsExample.wmls
extern function findabs()
{
var mydefault = "-71.348";
var result = Dialogs.prompt("Enter any number", mydefault);
var absnum =
Lang.abs(result)
;
WMLBrowser.setVar("number", result);
WMLBrowser.setVar("absnumber", absnum);
WMLBrowser.go("AbsExample.wml#card2");
};
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information