File:  [gforth] / gforth / test / dbltest.fs
Revision 1.4: download - view: text, annotated - select for diffs
Mon May 17 13:52:18 1999 UTC (20 years, 5 months ago) by jwilke
Branches: MAIN
CVS tags: HEAD
Added relative (./) includes.

    1: \ test some double primitives
    2: 
    3: \ Copyright (C) 1996,1998 Free Software Foundation, Inc.
    4: 
    5: \ This file is part of Gforth.
    6: 
    7: \ Gforth is free software; you can redistribute it and/or
    8: \ modify it under the terms of the GNU General Public License
    9: \ as published by the Free Software Foundation; either version 2
   10: \ of the License, or (at your option) any later version.
   11: 
   12: \ This program is distributed in the hope that it will be useful,
   13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
   14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15: \ GNU General Public License for more details.
   16: 
   17: \ You should have received a copy of the GNU General Public License
   18: \ along with this program; if not, write to the Free Software
   19: \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   20: 
   21: require ./tester.fs
   22: require ./coretest.fs
   23: 
   24: \ fm/mod, sm/rem, um/mod, s>d, m*, um* already covered in coretest.fs
   25: 
   26: { 0. 0 m+ -> 0. }
   27: { 0. 1 m+ -> 1. }
   28: { 0. -1 m+ -> -1. }
   29: { 1. -1 m+ -> 0. }
   30: { MAX-UINT 0 1 m+ -> 0 1 }
   31: { MAX-UINT MAX-UINT 1 m+ -> 0. }
   32: 
   33: { 0. 0. d+ -> 0. }
   34: { 1. -1. d+ -> 0. }
   35: { -1. 1. d+ -> 0. }
   36: { -1. -1. d+ -> -2. }
   37: { MAX-UINT 0 2dup d+ -> MAX-UINT 1- 1 }
   38: { MAX-UINT 1 1 1 d+ -> 0 3 }
   39: 
   40: { 0. 0. d- -> 0. }
   41: { 0. 1. d- -> -1. }
   42: { 0. -1. d- -> 1. }
   43: { 1. 0. d- -> 1. }
   44: { 1. 1. d- -> 0. }
   45: { -1. -1. d- -> 0. }
   46: { 1. -1. d- -> 2. }
   47: { -1. 1. d- -> -2. }
   48: { 0 2 1. d- -> MAX-UINT 1 }
   49: 
   50: { 0. dnegate -> 0. }
   51: { 1. dnegate -> -1. }
   52: { -2. dnegate -> 2. }
   53: { 0 1 dnegate -> 0 -1 }
   54: { 1 1 dnegate -> MAX-UINT -2 }
   55: 
   56: { 1. d2* -> 2. }
   57: { -10. d2* -> -20. }
   58: { MAX-UINT 1 d2* -> MAX-UINT 1- 3 }
   59: 
   60: { 0. d2/ -> 0. }
   61: { 1. d2/ -> 0. }
   62: { -1. d2/ -> -1. }
   63: { MAX-UINT 3 d2/ -> MAX-UINT 1 }
   64: 
   65: { 0. 0. d= -> true }
   66: { 0. 1. d= -> false }
   67: { 0 1 0 0 d= -> false }
   68: { 1 1 0 0 d= -> false }
   69: 
   70: { 0. 0. d<> -> false }
   71: { 0. 1. d<> -> true }
   72: { 0 1 0 0 d<> -> true }
   73: { 1 1 0 0 d<> -> true }
   74: 
   75: { 1. 1. d< -> false }
   76: { 0. 1. d< -> true }
   77: { 1 0 0 1 d< -> true }
   78: { 0 1 1 0 d< -> false }
   79: { -1. 0. d< -> true }
   80: 
   81: { 1. 1. d> -> false }
   82: { 0. 1. d> -> false }
   83: { 1 0 0 1 d> -> false }
   84: { 0 1 1 0 d> -> true }
   85: { -1. 0. d> -> false }
   86: 
   87: { 1. 1. d>= -> true }
   88: { 0. 1. d>= -> false }
   89: { 1 0 0 1 d>= -> false }
   90: { 0 1 1 0 d>= -> true }
   91: { -1. 0. d>= -> false }
   92: 
   93: { 1. 1. d<= -> true }
   94: { 0. 1. d<= -> true }
   95: { 1 0 0 1 d<= -> true }
   96: { 0 1 1 0 d<= -> false }
   97: { -1. 0. d<= -> true }
   98: 
   99: \ Since the d-comparisons, the du-comparisons, and the d0-comparisons
  100: \ are generated from the same source, we only test the ANS words in
  101: \ the following.
  102: 
  103: { 0. d0= -> true }
  104: { 1. d0= -> false }
  105: { 0 1 d0= -> false }
  106: { 1 1 d0= -> false }
  107: { -1. d0= -> false }
  108: 
  109: { 0. d0< -> false }
  110: { -1. d0< -> true }
  111: { -1 0 d0< -> false }
  112: { 0 min-int d0< -> true }
  113: 
  114: { 1. 1. du< -> false }
  115: { 0. 1. du< -> true }
  116: { 1 0 0 1 du< -> true }
  117: { 0 1 1 0 du< -> false }
  118: { -1. 0. du< -> false }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>