[Aldor-l] is sal_sfloat.as buggy?
David Casperson
casper at unbc.ca
Tue Sep 25 11:06:19 EDT 2007
Christian Aistleitner, on 2007-09-25, you wrote:
> Subject: Re: [Aldor-l] is sal_sfloat.as buggy?
>
> Hello,
>
>> [ various variants of importing powf ]
>
> to me, it is not so important, how many or which functions work for now.
> It is more important to me, to hit the correct semantics of the code.
>
> According to the manpage of powf on my machine, powf is a function taking
> two C floats and returning a C float.
>
> Therefore, to meet the functions requirements, one has to import it in
> exactly that way, by using C float's equivalent Aldor type, which
> according to the AUG (Chapter 19.3; page 195) is SFlo.
>
> Regardless of which of the various import statements work or do not work,
> regardless of which of the various import statements produce the correct
> width or incorrect width for their identifiers, only the import statement
> using SFlo meets the specification of the AUG and powf:
>
> import { powf: (SFlo, SFlo) -> SFlo } from Foreign C;
>
> It might well be that other formulations work as well (like using Rep
> instead of SFlo) but these formulations do not model powf adequately.
I think that it is an important question whether or not Rep can
be used in place of SFlo$Machine, I also tend to agree
with Christian Aistleitner that the SFlo formulation of the
declaration of powf is better than the Rep one, although I
believe that the semantics of Aldor say that they ought to be the
same. My reason for the superiority of the SFlo version is that
if someone changes the Rep == ... line, and forgets to change the
definition of ^$SingleFloat, then the code ought to produce an
error message in the Aldor compiler itself rather than in the C compiler
invoked on its behalf. (It seems that the latter aren't being
consistently noticed.)
Stephen, Oleg: surely we can get the Aldor compiler to produce
the semantic equivalent of a reinterpret cast here (add a temporary,
and cast its address through struct { unsigned char[sizeof
FiWord] ; } *, or something equally ugly but formally correct).
Am I understanding the technical question correctly to be "How do
we translate "pretend" into C?
Cheers,
David
--
Dr. David Casperson, Assistant Professor | casper at unbc.ca
Department of Computer Science | (250) 960-6672 Fax 960-5544
College of Science and Management | 3333 University Way
University of Northern British Columbia | Prince George, BC V2N 4Z9
| CANADA
More information about the Aldor-l
mailing list