toRational problem

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
17 Apr 2001 16:04:43 GMT


Mon, 16 Apr 2001 19:03:21 -0700, Ashley Yakeley <ashley@semantic.org> pisze:

> >> Why (toRational 0.9) == (9 % 10) is False?

Because the type of 0.9 is ambiguous and is being defaulted to Double.

You can just write 0.9: it will have type Rational if needed. No need
to convert it.

You can also add
    default (Integer, Rational)
in the module to let ambiguous numeric types default to Rational.

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK