If we multiply the exponents by, say, 10^20
, then the data will fall within machine-precision range. There may be a more natural way to rescale (based on units, for instance), but we have only raw numbers to work with. (One can also convert the mantissas to arbitrary-precision number before multiplying by the exponent; however, I suspect that machine numbers are to be preferred.)
data = #1*10.^(#2 + 20) & @@ Transpose[
ToExpression[
StringSplit[#, "E"] & /@
(raw = Import["https://pastebin.com/raw/gkB6zKVC", "Table", "Numeric" -> False])
],
{2, 3, 1}]; // AbsoluteTiming
(* {0.216465, Null} *)
Some checks. There are some rounding differences between the imported data and the converted data.
Dimensions@data
Dimensions@raw
(*
{76, 205}
{76, 205}
*)
Quiet@Block[{Indeterminate = 0},
Import["https://pastebin.com/raw/gkB6zKVC", "Table"]/data //
Flatten // DeleteDuplicates
]
(*
{0, 1.0000000000000001`*^-20, 1.0000000000000002`*^-20,
9.999999999999998`*^-21, 9.999999996284607`*^-21,
9.99999999915014`*^-21, 1.0000000000496418`*^-20,
1.0000000001289331`*^-20, 1.0000000002912905`*^-20,
1.000000000045069`*^-20, 9.999999995966217`*^-21,
1.0000000002256684`*^-20, 9.99999999965454`*^-21}
*)
Quiet[]
of course, but this just hides problems. Can you post a sample.dat
file that is triggering this warning? $\endgroup$ – J. M.'s ennui♦ Mar 31 '19 at 13:481.DAT
. How do you expect to get help if you don't post that file? $\endgroup$ – J. M.'s ennui♦ Mar 31 '19 at 14:061.DAT
, go to Pastebin, post the contents there, and then post a link here. $\endgroup$ – J. M.'s ennui♦ Mar 31 '19 at 14:09$MinMachineNumber
is2.22507*10^-308
(Windows 10, Mathematica 10.4). Your dataset has 9 out of 15580 numbers between1.094829709000000*10^-318
and1.319006165000000*10^-316
. If it is appropriate you could modify the data or maybe the following would be helpful: mathematica.stackexchange.com/questions/161031/…. $\endgroup$ – JimB Mar 31 '19 at 14:48