Float Variables

# Float (variable)

The float variable is the only type of numeric variable available in Pinnacle scriptng. It can hold most numbers but is limited to [Unknown]. Floats are used in place of other common numerical variables like int and long.

# Declare a float variable

````Store.FloatAt.SampleFloat = 5.141;`
```

or
````Store.At.SampleFloat = Float {Value = 5.141;};`
```

The name "SampleFloat" should be replaced with a more descriptive name. If the variable does not exist it is created, otherwise the current variable is overwritten.

# Mathematical Operations

## Display value in pop-up window

````InfoMessage=Store.FloatAt.SampleFloat;//Outputs 5.141`
```

## Add

````Store.At.SampleFloat.Add = 1;  // 5.141 + 1 = 6.141`
```

## Subtract

````Store.At.SampleFloat.Subtract = 3;   // 6.141 - 3 = 3.141`
```

## Multiply

````Store.At.SampleFloat.Multiply = 5;   // 3.141 * 5 = 15.705`
```

## Divide

````Store.At.SampleFloat.Divide = 6;   // 15.705 / 6 = 2.6175`
```

## Square

````Store.At.SampleFloat.Square = "";   // 2.6175^2 = 6.85130625`
```

## Square root

````Store.At.SampleFloat.SquareRoot= "";   // 6.85130625^(-1/2) = 2.6175`
```

## Invert

````Store.At.SampleFloat.Invert= "";   // 1 / 2.6175 = 0.38204394`
```

## Negative

````Store.At.SampleFloat.Negate= "";   // -0.38204394`
```

## Absolute value

````Store.At.SampleFloat.Absolute= "";  // 0.38204394`
```

## Round to nearest integer

````Store.At.SampleFloat.Nint = "";   //`
```

## Round down (Floor)

````Store.At.SampleFloat.Round = "";   //`
```

# Typecast to String Variable

Unlike typecasting (converting) from string to float variables, it's necessary to use the "StringAt" (string) and "At" (float) definitions of the variables.

``````Store.Float.At.Number = 7;

//--------**This step typecasts**
Store.StringAt.Text = Store.At.Number;
//

InfoMessage = Store.StringAt.Text;```
```

# Free a float variable

To delete a float variable use the FreeAt command. This will remove the variable from the store.

````Store.FreeAt.TempFloat = "";`
```
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License