On Fri, Jul 24, 2015 at 1:09 PM, Júlio Hoffimann <[email protected]>
wrote:

> Hi,
>
> Is there any definition of NaN for Integer types? Let's say I want to
> create a matrix with some unspecified entries, that is entries marked
> special. I am using NaN for Float64 but would like to make it work with
> other types too. Suggestions?
>

There is no pre-defined integer nan equivalent.

Option 1 (fast but unsafe): Pick a special int value that is rarely used,
e.g. typemin(Int).
Option 2 (works with all types, including Float64, and is safer): Use a
nullable type. This might complicate your code and may slightly increase
your memory usage.

-erik

-- 
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/

Reply via email to