File:  [gforth] / gforth / test / dbltest.fs
Revision 1.11: download - view: text, annotated - select for diffs
Mon Dec 31 18:40:26 2007 UTC (11 years, 7 months ago) by anton
Branches: MAIN
CVS tags: v0-7-0, HEAD
updated copyright notices for GPL v3

    1: \ test some double primitives
    2: 
    3: \ Copyright (C) 1996,1998,1999,2000,2003,2007 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 3
   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, see http://www.gnu.org/licenses/.
   19: 
   20: require ./tester.fs
   21: require ./coretest.fs
   22: 
   23: \ fm/mod, sm/rem, um/mod, s>d, m*, um* already covered in coretest.fs
   24: 
   25: { 0. 0 m+ -> 0. }
   26: { 0. 1 m+ -> 1. }
   27: { 0. -1 m+ -> -1. }
   28: { 1. -1 m+ -> 0. }
   29: { MAX-UINT 0 1 m+ -> 0 1 }
   30: { MAX-UINT MAX-UINT 1 m+ -> 0. }
   31: 
   32: { 0. 0. d+ -> 0. }
   33: { 1. -1. d+ -> 0. }
   34: { -1. 1. d+ -> 0. }
   35: { -1. -1. d+ -> -2. }
   36: { MAX-UINT 0 2dup d+ -> MAX-UINT 1- 1 }
   37: { MAX-UINT 1 1 1 d+ -> 0 3 }
   38: 
   39: { 0. 0. d- -> 0. }
   40: { 0. 1. d- -> -1. }
   41: { 0. -1. d- -> 1. }
   42: { 1. 0. d- -> 1. }
   43: { 1. 1. d- -> 0. }
   44: { -1. -1. d- -> 0. }
   45: { 1. -1. d- -> 2. }
   46: { -1. 1. d- -> -2. }
   47: { 0 2 1. d- -> MAX-UINT 1 }
   48: 
   49: { 0. dnegate -> 0. }
   50: { 1. dnegate -> -1. }
   51: { -2. dnegate -> 2. }
   52: { 0 1 dnegate -> 0 -1 }
   53: { 1 1 dnegate -> MAX-UINT -2 }
   54: 
   55: { 1. d2* -> 2. }
   56: { -10. d2* -> -20. }
   57: { MAX-UINT 1 d2* -> MAX-UINT 1- 3 }
   58: 
   59: { 0. d2/ -> 0. }
   60: { 1. d2/ -> 0. }
   61: { -1. d2/ -> -1. }
   62: { MAX-UINT 3 d2/ -> MAX-UINT 1 }
   63: 
   64: { 0. 0. d= -> true }
   65: { 0. 1. d= -> false }
   66: { 0 1 0 0 d= -> false }
   67: { 1 1 0 0 d= -> false }
   68: 
   69: { 0. 0. d<> -> false }
   70: { 0. 1. d<> -> true }
   71: { 0 1 0 0 d<> -> true }
   72: { 1 1 0 0 d<> -> true }
   73: 
   74: { 1. 1. d< -> false }
   75: { 0. 1. d< -> true }
   76: { 1 0 0 1 d< -> true }
   77: { 0 1 1 0 d< -> false }
   78: { -1. 0. d< -> true }
   79: 
   80: { 1. 1. d> -> false }
   81: { 0. 1. d> -> false }
   82: { 1 0 0 1 d> -> false }
   83: { 0 1 1 0 d> -> true }
   84: { -1. 0. d> -> false }
   85: 
   86: { 1. 1. d>= -> true }
   87: { 0. 1. d>= -> false }
   88: { 1 0 0 1 d>= -> false }
   89: { 0 1 1 0 d>= -> true }
   90: { -1. 0. d>= -> false }
   91: 
   92: { 1. 1. d<= -> true }
   93: { 0. 1. d<= -> true }
   94: { 1 0 0 1 d<= -> true }
   95: { 0 1 1 0 d<= -> false }
   96: { -1. 0. d<= -> true }
   97: 
   98: \ Since the d-comparisons, the du-comparisons, and the d0-comparisons
   99: \ are generated from the same source, we only test the ANS words in
  100: \ the following.
  101: 
  102: { 0. d0= -> true }
  103: { 1. d0= -> false }
  104: { 0 1 d0= -> false }
  105: { 1 1 d0= -> false }
  106: { -1. d0= -> false }
  107: 
  108: { 0. d0< -> false }
  109: { -1. d0< -> true }
  110: { -1 0 d0< -> false }
  111: { 0 min-int d0< -> true }
  112: 
  113: { 1. 1. du< -> false }
  114: { 0. 1. du< -> true }
  115: { 1 0 0 1 du< -> true }
  116: { 0 1 1 0 du< -> false }
  117: { -1. 0. du< -> false }
  118: 
  119: \ some M*/ consistency checks against */
  120: 
  121: { -7. 3 5 M*/ -> -7 3 5 */ s>d }
  122: {  7. 3 5 M*/ ->  7 3 5 */ s>d }

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