Search code examples
verilogrational-numbers

Rational numbers in Verilog


I need to use rational numbers in my Verilog code. I looked for any resource but I couldn't find anything about this issue. How can I define rational numbers in Verilog.


Solution

  • Verilog has a real data type which is used for real (floating-point) numbers:

    real data;
    initial data = 1.55;