Closed MauricioCarneiro closed 10 years ago
this should be addressed following #120
See the following test program I wrote:
https://gist.github.com/droazen/7eabfc2cd9054ba9886a
The output of this program is:
missing_value:
val is a NaN
val converted to int is missing
end_of_vector_value:
val is a NaN
val converted to int is vector end
What this shows is that:
we can still distinguish between the missing value and end of vector value by converting to int using the union trick in reverse and then comparing using ==. Eg.,
uint32_t bcf_float_missing = 0x7F800001; uint32_t bcf_float_vector_end = 0x7F800002; union { uint32_t i; float f; } u; u.f = val; if ( u.i == bcf_float_missing ) { ... else if ( u.i == bcf_float_vector_end ) { ...
I will do a pull request in a bit to implement this.
You can use functions bcf_float_is_missing and bcf_float_is_vector_end from htslib (htslib/vcf.h)
it should differentiate between the two.