Maybe you could make your own 64-bit bitstype, which restricted values to 
integer values in the range that will fit in a Float64 (around -2^53 to 
2^53).  Then you could be sure you didn't lose any information (give an 
InexactError if a value doesn't fit), and still allow for a NaN value, and 
fairly efficient computation.

On Friday, July 24, 2015 at 2:04:33 PM UTC-4, Júlio Hoffimann wrote:
>
> Thank you all, that is what I thought, I will stick with plain Float64 for 
> now.
>
> -Júlio
>
> 2015-07-24 10:59 GMT-07:00 Erik Schnetter <[email protected] <javascript:>
> >:
>
>> On Fri, Jul 24, 2015 at 1:09 PM, Júlio Hoffimann <[email protected] 
>> <javascript:>> 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] <javascript:>> 
>> http://www.perimeterinstitute.ca/personal/eschnetter/
>>  
>
>

Reply via email to