Difference between revisions of "ObjectType:float"

From Lavish Software Wiki
Jump to navigation Jump to search
m (DataType:float moved to ObjectType:float)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
{{ObjectType-Vitals|float|[[LavishScript]]|none|The string representation of this float, to the nearest hundredth|[[ObjectType:float|float]]|no|float}}
 
== Description ==
 
== Description ==
 
A float, named for its <tt>floating-point</tt>, represents a number with a [http://dictionary.reference.com/search?q=mantissa mantissa.]
 
A float, named for its <tt>floating-point</tt>, represents a number with a [http://dictionary.reference.com/search?q=mantissa mantissa.]
 +
  
 
== Members ==
 
== Members ==
* [[DataType:string|string]] '''Deci''': The value of this float, to the nearest tenth
+
* [[ObjectType:string|string]] '''Deci''': The value of this float, to the nearest tenth
* [[DataType:string|string]] '''Centi''': The value of this float, to the nearest hundredth
+
* [[ObjectType:string|string]] '''Centi''': The value of this float, to the nearest hundredth
* [[DataType:string|string]] '''Milli''': The value of this float, to the nearest thousandth
+
* [[ObjectType:string|string]] '''Milli''': The value of this float, to the nearest thousandth
* [[DataType:int|int]] '''Int''': The value of this float, to its largest whole number (e.g. for 1.9 this is 1, for -0.1, this is -1)
+
* [[ObjectType:int|int]] '''Int''': The value of this float, to its largest whole number (e.g. for 1.9 this is 1, for -0.1, this is -1)
* [[DataType:string|string]] '''Precision['''#''']''': The value of this float, to the nearest # decimal places (e.g. 1 is tenths, 2 is hundredths, 3 is thousandths, and so on)
+
* [[ObjectType:string|string]] '''Precision['''#''']''': The value of this float, to the nearest # decimal places (e.g. 1 is tenths, 2 is hundredths, 3 is thousandths, and so on)
* [[DataType:int|int]] '''Ceil''': The value of this float, to its largest partial number (e.g. for 1.1 this is 2, for -0.1 this is 0).
+
* [[ObjectType:int|int]] '''Ceil''': The value of this float, to its largest partial number (e.g. for 1.1 this is 2, for -0.1 this is 0).
* [[DataType:int|int]] '''Round''': The value of this float, rounded to the nearest whole number
+
* [[ObjectType:int|int]] '''Round''': The value of this float, rounded to the nearest whole number
 +
* [[ObjectType:bool|bool]] '''Between[a,b]''': TRUE if  a<= value and value <= b
 +
* [[ObjectType:bool|bool]] '''Equal['''[[LavishScript:Mathematical Formulae|formula]]''']''': TRUE if the float matches the specified value
 +
* [[ObjectType:string|string]] '''AsJSON''': A string with the value of the float, as would be in JSON
 +
 
  
 
== Methods ==
 
== Methods ==
Line 18: Line 24:
 
* '''Set['''[[LavishScript:Mathematical Formulae|formula]]''']''': Sets this float to a given value
 
* '''Set['''[[LavishScript:Mathematical Formulae|formula]]''']''': Sets this float to a given value
  
== Returns ==
 
The string representation of this float, to the nearest hundredth
 
  
 
== Examples ==
 
== Examples ==
Line 35: Line 39:
 
:'''Note:''' These two commands are identical
 
:'''Note:''' These two commands are identical
  
== Operates On ==
 
<tt>float</tt>
 
  
 
== See Also ==
 
== See Also ==
* [[LavishScript:Data Types|Data Types]]
+
{{LavishScript:ObjectType}}
 
 
[[Category:LavishScript]]
 
[[Category:LavishScript Data Types]]
 

Latest revision as of 14:21, 14 October 2019

Object Type Vitals
float
Defined By LavishScript
Inherits none
Reduces To The string representation of this float, to the nearest hundredth
Variable Object Type float
Uses Sub-Types no
C/C++ Type float

Description

A float, named for its floating-point, represents a number with a mantissa.


Members

  • string Deci: The value of this float, to the nearest tenth
  • string Centi: The value of this float, to the nearest hundredth
  • string Milli: The value of this float, to the nearest thousandth
  • int Int: The value of this float, to its largest whole number (e.g. for 1.9 this is 1, for -0.1, this is -1)
  • string Precision[#]: The value of this float, to the nearest # decimal places (e.g. 1 is tenths, 2 is hundredths, 3 is thousandths, and so on)
  • int Ceil: The value of this float, to its largest partial number (e.g. for 1.1 this is 2, for -0.1 this is 0).
  • int Round: The value of this float, rounded to the nearest whole number
  • bool Between[a,b]: TRUE if a<= value and value <= b
  • bool Equal[formula]: TRUE if the float matches the specified value
  • string AsJSON: A string with the value of the float, as would be in JSON


Methods

  • Inc: Increments this float by 1.0
  • Inc[formula]: Increments this float by a given amount
  • Dec: Decrements this float by 1.0
  • Dec[formula]: Decrements this float by a given amount
  • Set[formula]: Sets this float to a given value


Examples

Declare a float variable

  • Declare Faction float

Set a variable to a given number

  • Faction:Set[3912.392]

Increment a float variable

  • Faction:Inc

Decrement a float variable

  • Faction:Dec

Add two floating variables

  • bankcash1:Set[${bankcash1}+${bankcash2}]
  • bankcash1:Inc[${bankcash2}]
Note: These two commands are identical


See Also

LavishScript Object Types