Documentation for the libtiff tag setter function says that TIFFTAG_XRESOLUTION tag must be passed as float value. Code examples I see elsewhere (e.g. XS code for Graphics::TIFF), tutorials/examples on the web, SO answers, etc., as well as my own C tests show that, yes indeed, resolution is to be passed as float, and it all works as expected.
However, reading source, I see that callee treats it as double (only to convert it to float a few lines below). First surprise is why the heck and how it works. Even if values on stack are aligned to more than 4 bytes, these are not integers, and packed float value is not a substring of packed double value, is it?
I dug it all up, because I was writing FFI binding for aforementioned tag setter function. I tried different modules: FFI::Platypus, FFI::Raw (though both are libffi based), and they fail to set resolution tag, if I describe parameter as "float". Rather, tag is set to 0, regardless of parameter, function call itself doesn't fail. But, if parameter is described as "double", tag is set as expected (I'll post SSCCE if required).
So, looks like no problem, I have working code, which is temporary prototype anyway, but I'm confused. Even if I feel brave enough to ask libtiff people "maybe you have a bug?", they'd say "all code using libtiff in whole world works fine. What's FFI::Platypus and why would we care?"