Floor should return long value instead of int

X-ngb-disclaimer: Tue Jun 5 23:56:42 JST 2012Content-Disposition: inlineX-Scanned-By: MIMEDefang 2.64 on 10.81.104.13X-Scanned-By: MIMEDefang 2.64 on 10.144.120.30Hi,When I run the following command I am getting o/p as 0W.q)floor 2147483647.21434f0Wq)floor 6347291066f0WAs I can understand it’s because floor returns the int value and the above command returns the value which Is bigger than int.I am looking for the solution where instead of int my floor function should return long value.Is there any way to make floor return the long value instead of int?Thanks for your help in advance. Regards,PurveshThis e-mail (including any attachments) is confidential, may containproprietary or privileged information and is intended for the namedrecipient(s) only. Unintended recipients are prohibited from takingaction on the basis of information in this e-mail and must delete allcopies. Nomura will not accept responsibility or liability for theaccuracy or completeness of, or the presence of any virus or disablingcode in, this e-mail. If verification is sought please request a hardcopy. Any reference to the terms of executed transactions should betreated as preliminary only and subject to formal written confirmationby Nomura. Nomura reserves the right to monitor e-mail communicationsthrough its networks (in accordance with applicable laws). Noconfidentiality or privilege is waived or lost by Nomura by anymistransmission of this e-mail. Any reference to “Nomura” is areference to any entity in the Nomura Holdings, Inc. group.Please read our Electronic Communications Legal Notice which formspart of this e-mail: http://www.Nomura.com/email\_disclaimer.htm

X-ngb-disclaimer: Tue Jun 5 23:57:33 JST 2012Content-Disposition: inlineX-Scanned-By: MIMEDefang 2.64 on 10.81.104.13X-Scanned-By: MIMEDefang 2.64 on 10.144.120.31Hi,When I run the following command I am getting o/p as 0W.q)floor 2147483647.21434f0Wq)floor 6347291066f0WAs I can understand it’s because floor returns the int value and the above command returns the value which Is bigger than int.I am looking for the solution where instead of int my floor function should return long value.Is there any way to make floor return the long value instead of int?Thanks for your help in advance. Regards,PurveshThis e-mail (including any attachments) is confidential, may containproprietary or privileged information and is intended for the namedrecipient(s) only. Unintended recipients are prohibited from takingaction on the basis of information in this e-mail and must delete allcopies. Nomura will not accept responsibility or liability for theaccuracy or completeness of, or the presence of any virus or disablingcode in, this e-mail. If verification is sought please request a hardcopy. Any reference to the terms of executed transactions should betreated as preliminary only and subject to formal written confirmationby Nomura. Nomura reserves the right to monitor e-mail communicationsthrough its networks (in accordance with applicable laws). Noconfidentiality or privilege is waived or lost by Nomura by anymistransmission of this e-mail. Any reference to “Nomura” is areference to any entity in the Nomura Holdings, Inc. group.Please read our Electronic Communications Legal Notice which formspart of this e-mail: http://www.Nomura.com/email\_disclaimer.htm

casting to long (or to int) rounds.

so

myfloor:{“j”$x-.5}

Content-Disposition: inline

Hi Charles,<o:p></o:p>

Thanks for your reply. This function does work for +ve values but for ?ve values it?s giving wrong result.<o:p></o:p>

I think for ?ve value we need to put some extra logic.<o:p></o:p>

<o:p> </o:p>

q)myfloor -2147483647.0000<o:p></o:p>

-2147483648j<o:p></o:p>

q)floor -2.00<o:p></o:p>

-2<o:p></o:p>

<o:p> </o:p>

You can see in above example for -2.00 we are getting the floor as -2 in the same way for -2147483647.0000 we should get -2147483647 instead of -2147483648.<o:p></o:p>

<o:p> </o:p>

Regards,<o:p></o:p>

Purvesh<o:p></o:p>

<o:p> </o:p>

From: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] On Behalf Of Charles Skelton
Sent: Tuesday, June 05, 2012 8:55 PM
To: personal-kdbplus@googlegroups.com
Subject: Re: [personal kdb+] Floor should return long value instead of int<o:p></o:p>

<o:p> </o:p>

casting to long (or to int) rounds.<o:p></o:p>

so<o:p></o:p>

myfloor:{“j”$x-.5}<o:p></o:p>

On Tue, Jun 5, 2012 at 4:57 PM, <purvesh.yadav@nomura.com> wrote:<o:p></o:p>

Hi,
When I run the following command I am getting o/p as 0W.
q)floor 2147483647.21434f
0W
q)floor 6347291066f
0W

As I can understand it’s because floor returns the int value and the above command returns the value which Is bigger than int.
I am looking for the solution where instead of int my floor function should return long value.
Is there any way to make floor return the long value instead of int?
Thanks for your help in advance.

Regards,
Purvesh<o:p></o:p>


Submitted via Google Groups

Can you try this

myfloor:{$[0 = x mod 1; :“j”$x; :“j”$x-.5]}

?

regards,

?

With all the use kdb+ gets in the money game, there must be some material showing the floor family of functions.  Have you looked at the wiki at code.kx.com ?

myfloor2:{“j”$x div 1}

should work

q){“j”$x div 1} -2147483648.1

-2147483649j

q){“j”$x div 1} -2147483648.0

-2147483648j

Content-Disposition: inline

Thanks this works fine.<o:p></o:p>

<o:p> </o:p>

Regards,<o:p></o:p>

Purvesh<o:p></o:p>

From: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] On Behalf Of Q_developer
Sent: Wednesday, June 06, 2012 2:20 PM
To: personal-kdbplus@googlegroups.com
Subject: Re: [personal kdb+] Floor should return long value instead of int<o:p></o:p>

<o:p> </o:p>

Can you try this<o:p></o:p>

myfloor:{$[0 = x mod 1; :“j”$x; :“j”$x-.5]}<o:p></o:p>

 <o:p></o:p>

regards,<o:p></o:p>

 <o:p></o:p>

On Wed, Jun 6, 2012 at 12:14 PM, <purvesh.yadav@nomura.com> wrote:<o:p></o:p>

Hi Charles,<o:p></o:p>

Thanks for your reply. This function does work for +ve values but for ?ve values it?s giving wrong result.<o:p></o:p>

I think for ?ve value we need to put some extra logic.<o:p></o:p>

 <o:p></o:p>

q)myfloor -2147483647.0000<o:p></o:p>

-2147483648j<o:p></o:p>

q)floor -2.00<o:p></o:p>

-2<o:p></o:p>

 <o:p></o:p>

You can see in above example for -2.00 we are getting the floor as -2 in the same way for -2147483647.0000 we should get -2147483647 instead of -2147483648.<o:p></o:p>

 <o:p></o:p>

Regards,<o:p></o:p>

Purvesh<o:p></o:p>

 <o:p></o:p>

From: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] On Behalf Of Charles Skelton
Sent: Tuesday, June 05, 2012 8:55 PM
To: personal-kdbplus@googlegroups.com
Subject: Re: [personal kdb+] Floor should return long value instead of int<o:p></o:p>

 <o:p></o:p>

casting to long (or to int) rounds.<o:p></o:p>

so<o:p></o:p>

myfloor:{“j”$x-.5}<o:p></o:p>

On Tue, Jun 5, 2012 at 4:57 PM, <purvesh.yadav@nomura.com> wrote:<o:p></o:p>

Hi,
When I run the following command I am getting o/p as 0W.
q)floor 2147483647.21434f
0W
q)floor 6347291066f
0W

As I can understand it’s because floor returns the int value and the above command returns the value which Is bigger than int.
I am looking for the solution where instead of int my floor function should return long value.
Is there any way to make floor return the long value instead of int?
Thanks for your help in advance.

Regards,
Purvesh<o:p></o:p>


Submitted via Google Groups

Content-Disposition: inline

Thanks Peter, This works fine for me.<o:p></o:p>

<o:p> </o:p>

Regards,<o:p></o:p>

Purvesh<o:p></o:p>

From: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] On Behalf Of Peter Byrne
Sent: Wednesday, June 06, 2012 3:10 PM
To: personal-kdbplus@googlegroups.com
Subject: Re: [personal kdb+] Floor should return long value instead of int<o:p></o:p>

<o:p> </o:p>

myfloor2:{“j”$x div 1}<o:p></o:p>

<o:p> </o:p>

should work<o:p></o:p>

<o:p> </o:p>

q){“j”$x div 1} -2147483648.1<o:p></o:p>

-2147483649j<o:p></o:p>

q){“j”$x div 1} -2147483648.0<o:p></o:p>

-2147483648j<o:p></o:p>

<o:p> </o:p>

<o:p> </o:p>

On 6 June 2012 10:18, Jack Andrews <effbiae@gmail.com> wrote:<o:p></o:p>

With all the use kdb+ gets in the money game, there must be some material showing the floor family of functions.  Have you looked at the wiki atcode.kx.com ?<o:p></o:p>

On 06/06/2012, at 2:14 PM, <purvesh.yadav@nomura.com> wrote:<o:p></o:p>

Hi Charles,<o:p></o:p>

Thanks for your reply. This function does work for +ve values but for ?ve values it?s giving wrong result.<o:p></o:p>

I think for ?ve value we need to put some extra logic.<o:p></o:p>

 <o:p></o:p>

q)myfloor -2147483647.0000<o:p></o:p>

-2147483648j<o:p></o:p>

q)floor -2.00<o:p></o:p>

-2<o:p></o:p>

 <o:p></o:p>

You can see in above example for -2.00 we are getting the floor as -2 in the same way for -2147483647.0000 we should get -2147483647 instead of -2147483648.<o:p></o:p>

 <o:p></o:p>

Regards,<o:p></o:p>

Purvesh<o:p></o:p>

 <o:p></o:p>

From: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] On Behalf Of Charles Skelton
Sent: Tuesday, June 05, 2012 8:55 PM
To: personal-kdbplus@googlegroups.com
Subject: Re: [personal kdb+] Floor should return long value instead of int<o:p></o:p>

 <o:p></o:p>

casting to long (or to int) rounds.<o:p></o:p>

so<o:p></o:p>

myfloor:{“j”$x-.5}<o:p></o:p>

On Tue, Jun 5, 2012 at 4:57 PM, <purvesh.yadav@nomura.com> wrote:<o:p></o:p>

Hi,
When I run the following command I am getting o/p as 0W.
q)floor 2147483647.21434f
0W
q)floor 6347291066f
0W

As I can understand it’s because floor returns the int value and the above command returns the value which Is bigger than int.
I am looking for the solution where instead of int my floor function should return long value.
Is there any way to make floor return the long value instead of int?
Thanks for your help in advance.

Regards,
Purvesh<o:p></o:p>


Submitted via Google Groups