Lasso Soft Inc. > Home

[ decimal ]

Type

[Decimal] casts a value to data type decimal. The following rules apply when performing this conversion.

  • Integer values are cast to their decimal equivalent.
  • String values that contain only a decimal or integer representation are cast to the decimal equivalent.
  • Null values are cast to 0.

It is not possible to use this method to cast values of types map or array.

  • Syntax
  • Methods
  • Traits
Decimal('Value')

local(VariableName) = Decimal('Value')
Has methods:
  • decimal->oncompare(p0::decimal)
  • decimal->oncompare(i::integer)
  • decimal->+(p0::decimal)
  • decimal->+(i::integer)
  • decimal->+()
  • decimal->-(p0::decimal)
  • decimal->-(i::integer)
  • decimal->-()
  • decimal->*(p0::decimal)
  • decimal->*(i::integer)
  • decimal->/(p0::decimal)
  • decimal->/(i::integer)
  • decimal->bytes()
  • decimal->acos()
  • decimal->asin()
  • decimal->atan()
  • decimal->atan2(p0::decimal)
  • decimal->ceil()
  • decimal->cos()
  • decimal->cosh()
  • decimal->exp()
  • decimal->fabs()
  • decimal->floor()
  • decimal->frexp()
  • decimal->ldexp(p0::integer)
  • decimal->log()
  • decimal->log10()
  • decimal->modf()
  • decimal->pow(p0::decimal)
  • decimal->sin()
  • decimal->sinh()
  • decimal->sqrt()
  • decimal->tan()
  • decimal->tanh()
  • decimal->erf()
  • decimal->erfc()
  • decimal->gamma()
  • decimal->hypot()
  • decimal->j0()
  • decimal->j1(p0::decimal)
  • decimal->jn(p0::integer)
  • decimal->lgamma()
  • decimal->y0()
  • decimal->y1()
  • decimal->yn(p0::integer)
  • decimal->isnan()
  • decimal->acosh()
  • decimal->asinh()
  • decimal->atanh()
  • decimal->cbrt()
  • decimal->expm1()
  • decimal->nextafter(p0::decimal)
  • decimal->scalb(p0::decimal)
  • decimal->ilogb()
  • decimal->log1p()
  • decimal->logb()
  • decimal->remainder(p0::decimal)
  • decimal->rint()
  • decimal->abs()
  • decimal->asString(p0::string, p1::string, p2::string)
  • decimal->asString(-decimalChar::string = ?, -groupchar::string = ?, -precision::integer = ?, -scientific::boolean = ?, -padding::integer = ?, -padChar::string = ?, -padRight::boolean = ?)::string
  • decimal->asInteger()
Examples
  • Beginner

To cast a value to type decimal:

Use the [decimal] type. Values retrieved from an HTML form or URL using [Action_Param] are always of data type string. It is necessary to cast these values to type decimal if they are to be used in a mathematical expression using symbols.

The following example adds the values for two [Action_Param] methods using the math symbol +, where the submitted values for Price and Shipping are '10' and '2.50', respectively.

Code

decimal(action_param('Price')) + decimal(action_param('Shipping'))

Result

12.500000

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft