conversion error from double in c++ to long or float in kdb+

I am trying to convert some double types in c++ to longs or floats in kdb+

using kj and KJ to convert to kdb+ the following nos in c++

1068080561

-639597367

-1108929061

-1115727465

1072032170

get converted to 

47524255114672j and 4 other nos differing only in the last few digits

using kf and KF they get converted to 

2.328563e-310  and nos differing only in the last few digits.   Can you give some help here?

Many thanks 

please can you post code that exhibits the issue?

The following works for me. What are you doing differently?

$ more guy.cpp
#include"k.h"

extern “C” K f(K x){
  K y;
  J i;
  if(KF==xt){
    y=ktn(KJ,xn);
    for(i=0;i<xn;i++)
      kJ(y)[i]=kF(x)[i];
  }
  else if(-KF==xt)
    y=kj(xf);
  else
    y=krr((S)“type”);
  return y;
}
   
$ more guy.q
f:($"./guy")2:(f;1)
a:1068080561 -639597367 -1108929061 -1115727465 1072032170f
f a
f each a
$ g++ -bundle -undefined dynamic_lookup guy.cpp -DKXVER=3 -fPIC -o2 -o guy.so -m32
$ ./q guy.q
KDB+ 3.3t 2015.05.27 Copyright (C) 1993-2015 Kx Systems
m32/ 4()core ..

1068080561 -639597367 -1108929061 -1115727465 1072032170
1068080561 -639597367 -1108929061 -1115727465 1072032170
q)\

likewise the following works for me

#include"k.h"

extern “C” K f(K x){
  double d={1068080561,-639597367,-1108929061,-1115727465,1072032170};
  K y=ktn(KF,5);
  J i;
  for(i=0;i<y->n;i++)
    kF(y)[i]=d[i];
  return y;
}

$ ./q
KDB+ 3.3t 2015.05.27 Copyright (C) 1993-2015 Kx Systems
m32/ 4()core
q)\P 0
f:($"./guy")2:(f;1)q)
q)f
1068080561 -639597367 -1108929061 -1115727465 1072032170f
q)\