Páll
  FYI this is most current of the evolving approaches to extended precision 
https://github.com/JuliaArbTypes/ArbFloats.jl

On Wednesday, August 10, 2016 at 2:58:16 PM UTC-4, Jeffrey Sarnoff wrote:
>
> When one writes a module/package that implements a new type it is prudent 
> to provide a type-specific value hashing function.  This is particularly 
> important for immutable types where hash codes and isequal are more tightly 
> coupled than they are with mutable types.
>
> memhash_seed is a module/package specific constant that serves as the seed 
> value for hashing values of the new type.
> Here is an example, my type-specific hashing for values of type ArbFloat 
> (extended precision floating point types)
> where 'memhash_seed' is called has_arbfloat_lo
>  
>
> # a type specific hash function helps the type to 'just work'
> const hash_arbfloat_lo = (UInt === UInt64) ? 0x37e642589da3416a : 0x5d46a6b4
> const hash_0_arbfloat_lo = hash(zero(UInt), hash_arbfloat_lo)
> # two values of the same precision
> #    with identical midpoint significands and identical radus_exponentOf2s 
> hash equal
> # they are the same value, one is less accurate yet centered about the other
> hash{P}(z::ArbFloat{P}, h::UInt) =
>     hash(z.significand1$z.exponentOf2,
>          (h $ hash(z.significand2$(~reinterpret(UInt,P)), hash_arbfloat_lo)
>             $ hash_0_arbfloat_lo))
>
>
>
>
> On Tuesday, August 9, 2016 at 11:49:24 AM UTC-4, Páll Haraldsson wrote:
>>
>>
>> A.
>>
>> julia> @less Base.memhash_seed
>> ERROR: ArgumentError: argument is not a generic function
>>  in methods at ./reflection.jl:140
>>
>> I know what this means, but it would be nice for it to look up the 
>> source, and when it's actually a function (sometimes, I'm not sure of the 
>> right parameters..). Is there a way for @less, @which @edit (I guess always 
>> same mechanisim) to work? Maybe already ion 0.5? Easy to add? I like 
>> reading the source code to learn, and not have to google or search github 
>> or ask here..
>>
>> [apropos got me nowhere.]
>>
>>
>> B.
>>
>> Bonus point, I think I know what memhash[_seed] is.. but what is it.
>>
>>
>> C.
>>
>> Trying to google it:
>>
>> https://searchcode.com/codesearch/view/84537847/
>>
>> Language  Lisp
>> [Clearly Julia source code, elsewhere I've seen Python autodetected..]
>>
>> -- 
>> Palli.
>>
>>

Reply via email to