* ambiguous universal_fixed_expression
@ 2004-11-27 18:16 xadian
2004-11-27 19:08 ` Martin Krischik
2004-11-27 20:52 ` Jeffrey Carter
0 siblings, 2 replies; 3+ messages in thread
From: xadian @ 2004-11-27 18:16 UTC (permalink / raw)
Hi
I've got a problem with an Ada program(surprise ;D).
With this line:
x := sol_Ty((var_Ar(f)*var_Ar(b))-(var_Ar(e)*var_Ar(c))/z);
-- x : sol_Ty := (f*b - e*c) / z;
I get the following errors:
> ambiguous universal_fixed_expression
> possible interpretation as type "Standard.duration"
> possible interpretation as type "sol_Ty" defined at line 8
The minus in the middle is highlighted after the errors.
var_Ar is an array of the type sol_Ty and x is also sol_Ty. sol_Ty
definition is a decimal fixed point:
> type sol_Ty is delta 0.01 digits 18;
I never worked with duration so can anyone tell me (or link something)
what it is and why it can be missinterpreted in this case? And how i can
GENERALLY solve it?!
thx already
xadian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ambiguous universal_fixed_expression
2004-11-27 18:16 ambiguous universal_fixed_expression xadian
@ 2004-11-27 19:08 ` Martin Krischik
2004-11-27 20:52 ` Jeffrey Carter
1 sibling, 0 replies; 3+ messages in thread
From: Martin Krischik @ 2004-11-27 19:08 UTC (permalink / raw)
xadian wrote:
> Hi
>
> I've got a problem with an Ada program(surprise ;D).
> With this line:
>
> x := sol_Ty((var_Ar(f)*var_Ar(b))-(var_Ar(e)*var_Ar(c))/z);
> -- x : sol_Ty := (f*b - e*c) / z;
>
> I get the following errors:
> > ambiguous universal_fixed_expression
> > possible interpretation as type "Standard.duration"
> > possible interpretation as type "sol_Ty" defined at line 8
> The minus in the middle is highlighted after the errors.
> var_Ar is an array of the type sol_Ty and x is also sol_Ty. sol_Ty
> definition is a decimal fixed point:
> > type sol_Ty is delta 0.01 digits 18;
> I never worked with duration so can anyone tell me (or link something)
> what it is and why it can be missinterpreted in this case? And how i can
> GENERALLY solve it?!
Maybe you should try sol_Ty'( instead of sol_Ty(. The difference is subtle:
the first means "interpret as" the other "convert to". the ' notiation is
paricular usefull for contants like 1.0 or so.
With Regards
Martin
--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ambiguous universal_fixed_expression
2004-11-27 18:16 ambiguous universal_fixed_expression xadian
2004-11-27 19:08 ` Martin Krischik
@ 2004-11-27 20:52 ` Jeffrey Carter
1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey Carter @ 2004-11-27 20:52 UTC (permalink / raw)
xadian wrote:
> x := sol_Ty((var_Ar(f)*var_Ar(b))-(var_Ar(e)*var_Ar(c))/z);
> -- x : sol_Ty := (f*b - e*c) / z;
>
> I get the following errors:
> > ambiguous universal_fixed_expression
> > possible interpretation as type "Standard.duration"
> > possible interpretation as type "sol_Ty" defined at line 8
> The minus in the middle is highlighted after the errors.
Multiplication and division of fixed-point values results in a value of
Universal_Fixed (ARM 4.5.5). Addition and subtraction, on the other
hand, take arguments of a specific fixed-point type and return a value
of the same type. So you need to tell the compiler the type of the
results of the multiplications:
X := Sol_Ty (Sol_Ty'(Var_Ar (F) * Var_Ar (B) ) -
Sol_Ty'(Var_Ar (E) * Var_Ar (C) ) / Z);
--
Jeff Carter
"Many times we're given rhymes that are quite unsingable."
Monty Python and the Holy Grail
57
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-11-27 20:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-27 18:16 ambiguous universal_fixed_expression xadian
2004-11-27 19:08 ` Martin Krischik
2004-11-27 20:52 ` Jeffrey Carter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox