Results 1 to 3 of 3

Thread: fractions?

  1. #1
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default fractions?

    Simba Code:
    program new;
    var
    e : extended;
    e2 : double;
    begin
    e := 50/100;
    e := 100*e;
    writeln(e);

    e2 := 50/100;
    e2 := 100*e2;
    writeln(e2);
    end.

    I'm confused

    Code:
    Compiled successfully in 31 ms.
    0
    0
    Successfully executed.

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Pascalscript use integer division when you do 50/100. Use 50.0/100.0 to get an exact result.

    In lape this will be fixed when it uses extended division by default. If you want to use integer division in lape use div.
    Working on: Tithe Farmer

  3. #3
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •