Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Real Number

Why run into the following test results inaccurate?

//first p

module real_number;

parameter a=1.2;

parameter b=1.5;

assign c=a+b;

initial begin

$display ("result is:",c);

# 10 $finish;

end

endmodule

result: x

but when running the program:

module real_number;

parameter a=1.2;

parameter b=1.5;

//assign c

initial begin

$display ("result is:",a+b);

# 10 $finish;

end

endmodule

we obtain accurate results: 3.7

if you want to write the program first, then how to write?

thanks!!!
No RepliesBe the first to reply