rounding off in csv

I save the table from the q script into a csv. The data is rounded off… for example 322895540.0089 is saved as 322890000. How can this be prevented?

Hi Dinesh,

If you set the float precision in your q process it should overcome this.

q)\P 0

q)tab1:(x:10?ab`c;y:10? 322895540.0089)

q)

q)

q)tab1

x y


a 126817992.46694344

b 166966416.31704471

c 166607527.70896146

c 131310054.17175606

b 57502483.491605178

a 97440914.857128918

b 253483657.22035778

c 172655349.11039421

a 229634153.31979713

b 132902828.27868339

q)

q)save `tab1.csv

Then format the columns in Excel and you should be all good.

| x | y |
| a | 126817992.466943000 |
| b | 166966416.317044000 |
| c | 166607527.708961000 |
| c | 131310054.171756000 |
| b | 57502483.491605100 |
| a | 97440914.857128900 |
| b | 253483657.220357000 |
| c | 172655349.110394000 |
| a | 229634153.319797000 |
| b | 132902828.278683000 |

http://code.kx.com/wiki/Cookbook/FloatPrecision

Thanks Rory

You can control the float precision using -P comand.

See http://code.kx.com/wiki/Reference/DisplayPrecision

hth

kim

Am 05.09.2012 07:24, schrieb Dinesh Goel:

I save the table from the q script into a csv. The data is rounded off… for example 322895540.0089 is saved as 322890000. How can this be prevented? –
You received this message because you are subscribed to the Google Groups “Kdb+ Personal Developers” group.
To view this discussion on the web visit https://groups.google.com/d/msg/personal-kdbplus/-/GLy6VRELeOUJ.
To post to this group, send email to personal-kdbplus@googlegroups.com.
To unsubscribe from this group, send email to personal-kdbplus+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/personal-kdbplus?hl=en.