Casting Symbol to Float or Int

1,118 views
Skip to first unread message

Raghuram

unread,
Nov 8, 2010, 10:34:19 PM11/8/10
to Kdb+ Personal Developers
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"$`1234
and i got error saying `type


Tim Rieder

unread,
Nov 8, 2010, 10:45:58 PM11/8/10
to personal...@googlegroups.com
"F"$string`1234



--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To post to this group, send email to personal...@googlegroups.com.
To unsubscribe from this group, send email to personal-kdbpl...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/personal-kdbplus?hl=en.


Raghuram

unread,
Nov 9, 2010, 12:16:09 AM11/9/10
to Kdb+ Personal Developers
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...@gmail.com> wrote:
> "F"$string`1234
>
>
>
> On Mon, Nov 8, 2010 at 10:34 PM, Raghuram <gpraghu...@gmail.com> wrote:
> > 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"$`1234
> > and i got error saying `type
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Kdb+ Personal Developers" group.
> > To post to this group, send email to personal...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > personal-kdbpl...@googlegroups.com<personal-kdbplus%2Bunsubscrib­e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/personal-kdbplus?hl=en.- Hide quoted text -
>
> - Show quoted text -

hlivni

unread,
Nov 9, 2010, 12:30:42 AM11/9/10
to Kdb+ Personal Developers
upper case letter is used to parse strings. lower case letter is used
to type cast

/ parse string into float
q) "F"$"23.54"
23.54
/type cast real into float
q)type
23.54e
-8h
q)type
"f"$23.54e
-9h
> > >http://groups.google.com/group/personal-kdbplus?hl=en.-Hide quoted text -

Charles Skelton

unread,
Nov 8, 2010, 10:39:08 PM11/8/10
to personal...@googlegroups.com
q)"F"$string `1234                                                                                                         
1234f

--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To post to this group, send email to personal...@googlegroups.com.
To unsubscribe from this group, send email to personal-kdbpl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages