+;;;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+;;;;
+;;;; This library is free software; you can redistribute it and/or
+;;;; modify it under the terms of the GNU Lesser General Public
+;;;; License as published by the Free Software Foundation; either
+;;;; version 3 of the License, or (at your option) any later version.
+;;;;
+;;;; This library is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;;; Lesser General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU Lesser General Public
+;;;; License along with this library; if not, write to the Free Software
+;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+;;;; Based in part on code from GNU CLISP, Copyright (C) 1993 Michael Stoll
+
(define-module (test-suite test-fractions)
#:use-module (test-suite lib)
#:use-module (ice-9 documentation)
(testeqv 3/4 6/8)
(testeqv 3/4 3000000000000/4000000000000)
(testeqv 3 3/1)
- (test= 1/3 (/ 1.0 3.0))
+
+ (test= -1 (/ most-negative-fixnum (- most-negative-fixnum)))
+ (testeq #t (integer? (/ most-negative-fixnum (- most-negative-fixnum))))
+
(testeqv (+ 1/4 1/2) 3/4)
(testeqv (* 1/4 2/3) 1/6)
(testeqv (/ 1/4 2/3) 3/8)
(testeqv (expt 2 1/2) (sqrt 2))
(testeqv (expt 1/2 2) 1/4)
(testeqv (expt 2.0 1/2) (sqrt 2))
- (testeqv (expt 1/2 2.0) 1/4)
- (testeqv (real-part 3/4) .75)
+ (testeqv (expt 1/2 2) 1/4)
+ (testeqv (real-part 3/4) 3/4)
(testeqv (imag-part 3/4) 0)
(testeqv (numerator 3/4) 3)
(testeqv (denominator 3/4) 4)
(testeq (eqv? 3/4 .75) #f)
(testeq (eqv? 3/4 3/4) #t)
(testeq (eqv? 10197734562406803221/17452826108659293487 10197734562406803221/17452826108659293487) #t)
- (testeq (equal? 3/4 .75) #t)
+ (testeq (equal? 3/4 .75) #f)
(testeq (number? 3/4) #t)
(testeq (real? 3/4) #t)
(testeq (integer? 3/4) #f)
(testeqv (/ 1/2 1/4) 2)
(testeqv (/ 2 1/4) 8)
(testeqv (/ 1/4 2) 1/8)
- (testeqv (ash 1/2 0) 1/2)
- (testeqv (ash 1/2 1) 1)
- ;;(testeqv (ash 1/2 -1) 1/4)
(testeqv (floor 5/2) 2)
(testeqv (ceiling 5/2) 3)