[M3devel] Possible Bug?

Martin Bishop martinbishop at bellsouth.net
Wed May 6 02:57:43 CEST 2009


I have this code, for finding the roots of a quadratic equation:

MODULE Quad EXPORTS Main;

IMPORT IO, Fmt, RealSqrt;

TYPE Roots = ARRAY [1..2] OF REAL;

VAR r: Roots;

PROCEDURE Solve(a, b, c: REAL): Roots =
  VAR sd: REAL := RealSqrt.Sqrt(b * b - 4.0 * a * c);
      x: REAL;
  BEGIN
    IF b < 0.0 THEN
      x := (-b + sd) / 2.0 * a;
      RETURN Roots{x, c / (a * x)};
    ELSE
      x := (-b - sd) / 2.0 * a;
      RETURN Roots{c / (a * x), x};
    END;
  END Solve;

BEGIN
  r := Solve(1.0, -10.0E5, 1.0);
  IO.Put("X1 = " & Fmt.Real(r[1]) & " X2 = " & Fmt.Real(r[2]) & "\n");
END Quad.

When I try to build it, I get:

***
*** runtime error:
***    <*ASSERT*> failed: FloatMode.SetRounding not implemented
***    file "../src/float/IEEE-default/FloatMode.m3", line 14
***

Aborted


I'm using:

martin at thinkpad:~/Code/Modula-3/Test$ cm3 -version
Critical Mass Modula-3 version d5.7.1
  last updated: 2009-01-21
  compiled: 2009-04-01 13:11:43
  configuration: /usr/local/bin/cm3.cfg

which was installed from Jay's "std" binary package.



More information about the M3devel mailing list