<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">How make Float80 bridge with long double math.h c functions?<div class=""><br class=""></div><div class="">I resorts to use some orrible hacks like these: </div><div class=""><br class=""></div><div class="">// in f80.h</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">extern</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> sqrt_f80( </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *result, </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *v );</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">extern</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> pow_f80( </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *result, </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *v, </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *e );</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">...</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div class="">// in f80.c</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> sqrt_f80( </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *result, </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *v )<span class="Apple-tab-span" style="white-space:pre">        </span>{ *(</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">long</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">double</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *)result = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">sqrtl</span><span style="font-variant-ligatures: no-common-ligatures" class="">( *(</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">long</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">double</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *)v ); }</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> pow_f80( </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *result, </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *v, </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">void</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *e )<span class="Apple-tab-span" style="white-space:pre">        </span>{ *(</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">long</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">double</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *)result = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">powl</span><span style="font-variant-ligatures: no-common-ligatures" class="">( *(</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">long</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">double</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *)v,*(</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">long</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">double</span><span style="font-variant-ligatures: no-common-ligatures" class=""> *)e ); }</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">…</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">// in f80.swift</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> sqrt( </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> a:</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Float80</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Float80</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>{ </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> result = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Float80</span><span style="font-variant-ligatures: no-common-ligatures" class="">(); </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> v = a; </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">sqrt_f80</span><span style="font-variant-ligatures: no-common-ligatures" class="">( &result, &v ); </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> result; }</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> pow( </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> a:</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Float80</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> e:</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Float80</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Float80</span><span style="font-variant-ligatures: no-common-ligatures" class=""> { </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> result = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Float80</span><span style="font-variant-ligatures: no-common-ligatures" class="">(); </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> v1 = a; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> v2 = e; </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">pow_f80</span><span style="font-variant-ligatures: no-common-ligatures" class="">( &result, &v1, &v2 ); </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> result; }</span></div><div style="font-family: Menlo; font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="font-family: Menlo; font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">There is an easier way?</div><div class=""><br class=""></div><div class="">P.S. Sorry for my bad english.</div></div></span></div></span></div></span></div><div class=""></div></span></div></body></html>