# toFloat not defined

**URL:** <https://forum.inductiveautomation.com/t/tofloat-not-defined/8892>\
**Category:** Ignition\
**Created:** [August 12, 2014, 7:06pm UTC](https://forum.inductiveautomation.com/t/tofloat-not-defined/8892 "2014-08-12T19:06:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damon](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@damon](https://forum.inductiveautomation.com/u/damon)\
**Post date:** [August 12, 2014, 7:06pm UTC](https://forum.inductiveautomation.com/t/tofloat-not-defined/8892/1 "2014-08-12T19:06:18Z")

</div>

Hello,

I am new to the ignition program and I have been trying to create some new faceplates. I noticed that the slider object only produces integer values.

Since the objective of the slider is to write float values in the range of -2.00 to 2.00 to an OPC tag, a script is written when the mouse click is released. The slider has been scaled up by 100 (range is now -200 and 200).

The original idea was to use toFloat( slider value ) to cast the integer to a float and after that I can do basic mathematical operations to the value. However, Ignition seem to think “toFloat( )” is not a predefined function, how do I resolve this problem?

Thanks in advance!

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b10ad1879b84ea71f49f0f50fa4b9b7dd36f29a0.jpg)  
  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/dddc092635d6d469fdcaa51eaf1f6f2948a640bb.jpg)

---

<div class="post-metadata">

**Author:** ![Pat](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Pat](https://forum.inductiveautomation.com/u/Pat)\
**Post date:** [August 12, 2014, 7:21pm UTC](https://forum.inductiveautomation.com/t/tofloat-not-defined/8892/2 "2014-08-12T19:21:28Z")

</div>

Try

```auto
value = float(event.source.value)
```

---

<div class="post-metadata">

**Author:** ![damon](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@damon](https://forum.inductiveautomation.com/u/damon)\
**Post date:** [August 12, 2014, 7:27pm UTC](https://forum.inductiveautomation.com/t/tofloat-not-defined/8892/3 "2014-08-12T19:27:17Z")

</div>

Works like a charm!

Thanks!!! 😃
