应为二元运算符,但除法符号中有一个二元运算符

Binary operator expected, but there is a binary operator as in the division symbol

你好,我在函数的开始部分得到 binary operator expected。我该如何解决这个问题?

procedure  float_test is
    A : Integer := 3;
    B : Integer := 2;
    F : Float;
begin
    F := (Float) A / (Float) B;
end float_test;

我从 here: adacore.com

获得了代码
procedure  float_test is
    A : Integer := 3;
    B : Integer := 2;
    F : Float;
begin
    F := A / B;
end float_test;

描述说:The offending line must be changed to F := Float (A) / Float (B); in order to be accepted by the compiler.

在 Ada 中,您使用稍微不同的语法进行强制转换(看起来您正在使用 C 期望的语法)

改为:

F := Float(A) / Float(B);