Storing variable length arrays of doubles in MySQL without loss of information
Plan A:  Use NULL to indicate NaN.

Plan B:  Use JSON now.  Build whatever structure makes sense in you app, encode it in JSON, store it in a TEXT field.  Note:  JSON is expecting utf8 string inside.  Keep in mind that you need to fetch the entire JSON field and manipulate it in your app, not in SQL.