[m-users.] Too Slow

Matthias Güdemann matthias at guedemann.org
Tue May 12 06:41:27 AEST 2015


> from_string to get the correct value. But isn't this a problem in
> int.m, too?

> This results in 0 for min_int.

sorry, it is not 0, but int.abs(int.min_int) is negative (for some
grades)

,----
| :- module int_test.
| :- interface.
| :- import_module int, io.
| :- pred main(io::di, io::uo) is det.
| :- implementation.
| main(!IO) :-
|     ( abs(int.min_int) < 0 ->
|         io.print("error", !IO)
|     ;
|         io.print("ok", !IO)
|     ),
|     io.nl(!IO).
`----

This gives "error" for C and Java grade and "ok" for the Erlang
grade. This is probably unsuprising as Erlang natively has arbitrary
precision ints.

Matthias



More information about the users mailing list