Bug introduced in 9.0 and fixed in 10.3

I have a list of 10 000 3×3 matrices in Mathematica. The entries are rational numbers. I would like to write this to a file so I can load it again in the future. After some fussing with file formats, it looks like the one I'd like to use is "WDX". However, some of my numbers are quite large, and don't seem to want to export. Does anyone know a good way around this issue?

I can reproduce the sort of problem I'm having just by running:

Export[NotebookDirectory[] <> "junk.wdx", {42838805520130}, "WDX"]

which returns

BinaryWrite::nocoerce: 42838805520130 cannot be coerced to the specified format. >>

I've used the "MX" file format, which works well, but I want to be able to import the file on another computer. Other file types don't seem to work so well. (For example, the "Table" format bizarrely introduces extraneous commas.)

  • 3
    $\begingroup$ It looks like exports to WDX only accept 32bit signed integers. This restriction doesn't seem to be documented and is, I'd say, also rather unexpected for a format that is supposed to be able to store any type of Mathematica expressions. $\endgroup$ Jun 10, 2013 at 20:16
  • 3
    $\begingroup$ ExportString[(2^31)^x, "WDX"] works, but ExportString[(2^31)^1, "WDX"] doesn't. It seems that as long as it is part of an expression it's OK, but when it's used as a pure number, or a list of numbers it fails. ExportString[List[2^31], "WDX"] fails, but ExportString[List2[2^31], "WDX"] works. Looks like a bug to me. $\endgroup$ Jun 10, 2013 at 20:23
  • $\begingroup$ A good alternative should be Save. $\endgroup$ Jun 10, 2013 at 20:28
  • 6
    $\begingroup$ I'd encourage you to report this as a bug. It seems that, after updating Mathematica itself to support 64-bit machine numbers in version 9, WRI has forgotten to do the same for the WDX format. (This problem does not arise in version 8.) $\endgroup$ Jun 10, 2013 at 21:53
  • 1
    $\begingroup$ a better alternative than save is something like Export["file.mz", Compress[expression], "String"] $\endgroup$
    – Szabolcs
    Jun 11, 2013 at 8:33

1 Answer 1


This bug has been fixed as of Mathematica 10.3.0.

ImportString[ExportString[2^31, "WDX"], "WDX"]

(* 2147483648 *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.