<div dir="auto">Best to use int32_t etc. from stdint.h when size is necessary</div><br><div class="gmail_quote"><div dir="ltr">On Sun, May 13, 2018, 1:16 PM Jonathan Wilkes <<a href="mailto:jon.w.wilkes@gmail.com">jon.w.wilkes@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi list,<br>
<br>
Ok, I'm delving into IEEE 754 a bit more, and I want to<br>
get a handle on the m_pd.h public interface changes before<br>
delving too much deeper into the double-precision project.<br>
<br>
Here's our recent code change that Pranay ported from<br>
pd-double to check for subnormals (a.k.a. denormals), nans,<br>
and some other desiderata:<br>
<br>
<a href="https://git.purrdata.net/jwilkes/purr-data/commit/d0d6b54deb1b803c67d85bd5d123d3da98faf495" rel="noreferrer noreferrer" target="_blank">https://git.purrdata.net/jwilkes/purr-data/commit/d0d6b54deb1b803c67d85bd5d123d3da98faf495</a><br>
<br>
So basically we've replaced the old direct type-punning code<br>
with a union. From what I can tell, there are two benefits to<br>
the new approach:<br>
<br>
* we can error out on strict aliasing violations<br>
and thus ensure that no such violations accidentally get<br>
added in *other* parts of the code (where, unlike this macro,<br>
they likely would be bugs).<br>
<br>
* we can just do a comparison on the 2nd array element<br>
for double-precision<br>
<br>
However, we could still get silently borked for the following<br>
three cases:<br>
<br>
* systems where sizeof(int) != sizeof(float) for single-precision Purr Data<br>
<br>
* systems where sizeof(int) * 2 != sizeof(double) for double-precision Purr<br>
Data<br>
<br>
* big endian CPUs<br>
<br>
Should we add a preprocessor check for the type sizes and<br>
error out if they don't meet our assumptions?<br>
<br>
As far as big endian, I don't see anything in the way of<br>
consumer CPUs (and RISCV is apparently littleendian).<br>
<br>
Finally-- it appears that there is no issubnormal in<br>
math.h. Anyone have a clue why that is?<br>
<br>
-Jonathan<br>
_______________________________________________<br>
L2Ork-dev mailing list<br>
<a href="mailto:L2Ork-dev@disis.music.vt.edu" target="_blank" rel="noreferrer">L2Ork-dev@disis.music.vt.edu</a><br>
<a href="https://disis.music.vt.edu/listinfo/l2ork-dev" rel="noreferrer noreferrer" target="_blank">https://disis.music.vt.edu/listinfo/l2ork-dev</a></blockquote></div>