KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Five easy pieces #2: getting around Re: Five easy pieces #2: getting around

  • SJT

    Member
    December 3, 2022 at 12:00 am

    Eliminating up and dn is a good move, but that doesnt quite work.

     

    q)rnd:{(`up`dn`nr!(f ceiling;(f:{string(x z*s)%s:10 xexp y})floor;.Q.f'))[z][;y;x]} 
    
    q)q:9.638554216867471
    q)rnd[q;2;`up] {string(x z*s)%s:10 xexp y}[-_-:][;2;9.638554]