# Casting Symbol to Float or Int

**URL:** <https://forum.kx.com/t/casting-symbol-to-float-or-int/6774>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [November 9, 2010, 3:34am UTC](https://forum.kx.com/t/casting-symbol-to-float-or-int/6774 "2010-11-09T03:34:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gpraghuram](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@gpraghuram](https://forum.kx.com/u/gpraghuram)\
**Post date:** [November 9, 2010, 3:34am UTC](https://forum.kx.com/t/casting-symbol-to-float-or-int/6774/1 "2010-11-09T03:34:00Z")

</div>

How can i typecast a symbol to float.Example:I have `1234 and i need to typecast the same to int or float.I tried this"f"$`1234and i got error saying `type

---

<div class="post-metadata">

**Author:** ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)\
**Post date:** [November 9, 2010, 3:39am UTC](https://forum.kx.com/t/casting-symbol-to-float-or-int/6774/2 "2010-11-09T03:39:00Z")

</div>

q)“F”$string `1234 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

1234f

---

<div class="post-metadata">

**Author:** ![trieder](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@trieder](https://forum.kx.com/u/trieder)\
**Post date:** [November 9, 2010, 3:45am UTC](https://forum.kx.com/t/casting-symbol-to-float-or-int/6774/3 "2010-11-09T03:45:00Z")

</div>

“F”$string`1234

---

<div class="post-metadata">

**Author:** ![gpraghuram](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@gpraghuram](https://forum.kx.com/u/gpraghuram)\
**Post date:** [November 9, 2010, 5:16am UTC](https://forum.kx.com/t/casting-symbol-to-float-or-int/6774/4 "2010-11-09T05:16:00Z")

</div>

Thanks a lot it worked.I have one more questionWhats the difference between “F”$0 and “f”$0RaghuOn Nov 9, 11:45?am, Tim Rieder \<trie…\> wrote:\> “F”$string`1234&gt;&gt;&gt;&gt; On Mon, Nov 8, 2010 at 10:34 PM, Raghuram <gpraghu...> wrote:&gt; &gt; How can i typecast a symbol to float.&gt; &gt; Example:&gt; &gt; I have `1234 and i need to typecast the same to int or float.\>\> \> I tried this\> \> “f”$`1234&gt; &gt; and i got error saying `type\>\> \> –\> \>

Submitted via Google Groups\</gpraghu…\>\</trie…\>

---

<div class="post-metadata">

**Author:** ![hlivni](https://avatars.discourse-cdn.com/v4/letter/h/f4b2a3/32.png) [@hlivni](https://forum.kx.com/u/hlivni)\
**Post date:** [November 9, 2010, 5:30am UTC](https://forum.kx.com/t/casting-symbol-to-float-or-int/6774/5 "2010-11-09T05:30:00Z")

</div>

upper case letter is used to parse strings. lower case letter is usedto type cast/ parse string into floatq) “F”$“23.54"23.54/type cast real into floatq)type23.54e-8hq)type"f”$23.54e-9hOn Nov 8, 11:16?pm, Raghuram \<gpraghu…\> wrote:\> Thanks a lot it worked.\> I have one more question\> Whats the difference between “F”$0 and “f”$0\>\> Raghu\>\> On Nov 9, 11:45?am, Tim Rieder \<trie…\> wrote:\>\> \> “F”$string`1234&gt;&gt; &gt; On Mon, Nov 8, 2010 at 10:34 PM, Raghuram <gpraghu...> wrote:&gt; &gt; &gt; How can i typecast a symbol to float.&gt; &gt; &gt; Example:&gt; &gt; &gt; I have `1234 and i need to typecast the same to int or float.\>\> \> \> I tried this\> \> \> “f”$`1234&gt; &gt; &gt; and i got error saying `type\>\> \> \> –\> \> \>

Submitted via Google Groups\</gpraghu…\>\</trie…\>\</gpraghu…\>
