Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In Ada:

    with Ada.Text_IO; use Ada.Text_IO;
    procedure Example is
    begin
        Put_Line (Float (9999999999999999.0-9999999999999998.0)'Image);
    end Example;
Result:

     1.00000E+00
If I really wanted to, I could use a decimal instead, e.g.

    with Ada.Text_IO; use Ada.Text_IO;
    procedure Example is
        type Decimal is delta 1.0E-20 digits 38;
    begin
        Put_Line (Decimal (9999999999999999.0-9999999999999998.0)'Image);
    end Example;
Result:

     1.00000000000000000000


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: