<p dir="ltr">On 2 Feb 2016 7:50 pm, "Nikolay via Digitalmars-d" <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br>
><br>
> I am porting LDC/phobos/druntime to NetBSD. Currently my patch is merged into LDC master. I have several questions about phobos/druntime and general workflow.<br>
> As I can understand I should prepare pull requests for phobos/druntime master branches. LDC team will merge/cherry-pick changes into ldc branch from master later. Is it correct workflow?  Because it means that I can’t check my patch: there is no dmd compiler for NetBSD + phobos/druntime master branches.<br>
><br>
> Also I have a set of issues with real (long double) type. Several functions absent in NetBSD for real type (more specific - they are just aliases for functions with double). Other functions return less accurate values.<br>
> I have to disable a couple unit tests for NetBSD.<br>
> E.g. std/conv.d:2835 assert(to!string(r) == to!string(real.min_normal))<br>
> see related question:  <a href="http://stackoverflow.com/questions/35090322/netbsd-long-double-trouble">http://stackoverflow.com/questions/35090322/netbsd-long-double-trouble</a><br>
> But also there are a set of unit tests where I have to reduce accuracy. This problem affects std/internal/math/gammafunction.d, std/math.d, std/numeric.d, std/complex.d<br>
> E.g.  std/complex.d:792<br>
> assert(sin(complex(2.0L, 0)) == std.math.sin(2.0L));<br>
> I replace with:<br>
> assert(feqrel(sin(complex(2.0L, 0)).re, std.math.sin(2.0L)) > real.mant_dig-10);<br>
> My question is: should I wrap such changes with version(NetBSD) statement or it is acceptable reduce accuracy for all platforms?<br>
><br>
> PS<br>
> You can look to my code here (netbsd_patch branch):<br>
> <a href="https://github.com/nrTQgc/druntime">https://github.com/nrTQgc/druntime</a><br>
> <a href="https://github.com/nrTQgc/phobos">https://github.com/nrTQgc/phobos</a><br>
><br>
></p>
<p dir="ltr">Is NetBSD similar to FreeBSD in that you have 80-bit reals but only the first 53 bits of the mantissa are used?</p>
<p dir="ltr">I don't know how accurate LDC is when it sets up compile time float properties.  But what do you get when:</p>
<p dir="ltr">pragma (msg, real.sizeof);<br>
pragma (msg, real.mant_dig);</p>
<p dir="ltr">Alternatively, use a C program with printfs for:</p>
<p dir="ltr">sizeof(long double)<br>
LDBL_MANT_DIG</p>
<p dir="ltr">To make sure both ldc and gcc are agreeable.</p>
<p dir="ltr">Have a look at rt/dmain2.d (look for fldcw) if the problem is because of what I describe above.</p>