I am not getting any warnings for <br>
(a:%) ^ (b:%):% == {<br>
import { powf: (%, %) -> % } from Foreign C;<br>
powf(a, b);<br>
}<br>or<br><span class="q"> (a:%) ^ (b:%):% == {<br> import { powf: (Rep, Rep) -> Rep } from Foreign C;<br> per powf(rep a, rep b);<br> }<br>Imho, they are both correct, though have a potential for an
<br>error: if we decide to change the representation, e.g. box the <br>SFlo, the Aldor compiler won't notice the type mismatch<br>in the import. <br>To prevent this potential problem, one could write<br></span><span class="q">
(a:%) ^ (b:%):% == {<br> import { powf: (SFlo, SFlo) -> SFlo } from Foreign C;<br> coerce powf(coerce a, coerce b);<br> }</span><br><span class="q"><br></span>
<br>
This one<br><div style="direction: ltr;"><span class="q"> (a:%) ^ (b:%):% == {<br> import { powf: (%, %) -> % } from Foreign C;<br></span></div><div style="direction: ltr;"><span class="q"> per powf(rep a, rep b);
<br> }<br></span></div>however does produce a type mismatch error:<br>"/data/oleg/aldor_tree/aldor/install/aldor/linux/1.1.0/include/aldor.as", line 22: <br> rep x == ((x)@%) pretend Rep;<br>.........................^
<br>[L22 C26] #2 (Error) (After Macro Expansion) Argument 1 of `powf' did not match any possible parameter type.<br> The rejected type is Rep.<br> Expected type %.<br>Expanded expression was: a @ % pretend Rep<br>
<br>Oleg<br><br>
<br><div><span class="gmail_quote">2007/9/24, Stephen Watt <<a href="mailto:watt@scl.csd.uwo.ca" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">watt@scl.csd.uwo.ca</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
David, what warnings are you getting?<br><br>All three versions should give the right widths for the values.<br><br>We want to be careful about the pretends implied by the rep operators<br>because we dont want any unsigned->float conversions to take place.
<br>We just ant a re-interpretation cast in the generated C.<br><br>If the import statement reads ... from Foreign C("math.h") then that<br>should generate a #include <math.h> rather than a prototype.<br>
<br>-- Stephen<br><br><br>On Mon, Sep 24, 2007 at 10:48:23AM +0200, Ralf Hemmecke wrote:<br>> Hi David,<br>><br>> Looks like a bug to me. But it should rather read...<br>><br>> (a:%) ^ (b:%):% == {<br>
>
import { powf: (%, %) -> % } from Foreign C;<br>> per powf(rep a, rep b);<br>> }<br>><br>> Would someone disagree?<br>><br>> Ralf<br>><br>><br>><br>> On 09/24/2007 05:24 AM, David Casperson wrote:
<br>> > sal_sfloat.as in lib/aldor/src/arith/ contains the lines<br>> ><br>> > ----------------------------------------------------------------------<br>> > Rep == SFlo;<br>> ><br>> > -- ...
<br>> ><br>> > (a:%) ^ (b:%):% == {<br>>
>
import { powf: (%, %) -> % } from Foreign C;<br>> > powf(a, b);<br>> > }<br>> > ----------------------------------------------------------------------<br>> ><br>> > am I hallucinating or shouldn't this be?
<br>> ><br>> > ----------------------------------------------------------------------<br>> > Rep == SFlo;<br>> ><br>> > -- ...<br>> ><br>> > (a:%) ^ (b:%):% == {<br>>
>
import { powf: (Rep, Rep) -> Rep } from Foreign C;<br>> > per powf(rep a, rep b);<br>> > }<br>> > ----------------------------------------------------------------------<br>> ><br>
> > The current version gives warning messages about type mismatches.<br>><br>> _______________________________________________<br>> Aldor-l mailing list<br>> <a href="mailto:Aldor-l@aldor.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Aldor-l@aldor.org
</a><br>> <a href="http://aldor.org/mailman/listinfo/aldor-l_aldor.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://aldor.org/mailman/listinfo/aldor-l_aldor.org</a><br><br>_______________________________________________
<br>Aldor-l mailing list<br><a href="mailto:Aldor-l@aldor.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Aldor-l@aldor.org</a><br><a href="http://aldor.org/mailman/listinfo/aldor-l_aldor.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://aldor.org/mailman/listinfo/aldor-l_aldor.org</a><br></blockquote>
</div><br>