Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fwrite fails to write 9.999999999999998 #1847

Closed
tbetz opened this issue Sep 13, 2016 · 0 comments
Closed

fwrite fails to write 9.999999999999998 #1847

tbetz opened this issue Sep 13, 2016 · 0 comments
Milestone

Comments

@tbetz
Copy link

tbetz commented Sep 13, 2016

I tried to write a data.table to a file with fwrite, and noticed that the value of one column is not written.

dt <- data.table(V1=c(1), V2=c(9.9999999999999982236431605997495353221893310546875))
fwrite(dt, file="test.txt", sep=";")

The output file looks like this:
V1;V2
1

I expected it to look like this:
V1;V2
1;10

If I revert the column order, calling fwrite crashes my R session.

dt <- data.table(V2=c(9.9999999999999982236431605997495353221893310546875), V1=c(1))
fwrite(dt, file="test.txt", sep=";") # this causes R to crash

The details for the crash are (sorry about the German output, not sure how to change that to English):
Problemsignatur:
Problemereignisname: APPCRASH
Anwendungsname: rsession.exe
Anwendungsversion: 0.99.903.0
Anwendungszeitstempel: 00000000
Fehlermodulname: ntdll.dll
Fehlermodulversion: 6.1.7601.23455
Fehlermodulzeitstempel: 573a54b7
Ausnahmecode: c0000005
Ausnahmeoffset: 000000000004e27c
Betriebsystemversion: 6.1.7601.2.1.0.256.48
Gebietsschema-ID: 1031
Zusatzinformation 1: 1ef2
Zusatzinformation 2: 1ef2a2536739df668f2a666c3c230c35
Zusatzinformation 3: 6c5c
Zusatzinformation 4: 6c5c2328a6b86468f828af8fe0e531ef

My session info is as follows:
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] data.table_1.9.7

loaded via a namespace (and not attached):
[1] tools_3.3.1

data.table 1.9.7 IN DEVELOPMENT built 2016-09-11 14:38:19 UTC; travis

@mattdowle mattdowle added this to the v1.9.8 milestone Sep 14, 2016
@mattdowle mattdowle changed the title fwrite fails to write numeric value fwrite fails to write numeric 9.999999999999998223 Oct 28, 2016
@mattdowle mattdowle changed the title fwrite fails to write numeric 9.999999999999998223 fwrite fails to write 9.999999999999998223 Oct 28, 2016
@mattdowle mattdowle changed the title fwrite fails to write 9.999999999999998223 fwrite fails to write 9.999999999999998 Oct 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants