--- gforth/test/gforth.fs 2007/12/31 18:40:26 1.15 +++ gforth/test/gforth.fs 2011/08/10 13:55:03 1.18 @@ -1,6 +1,6 @@ \ test some gforth extension words -\ Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc. +\ Copyright (C) 2003,2004,2005,2006,2007,2009 Free Software Foundation, Inc. \ This file is part of Gforth. @@ -87,3 +87,24 @@ decimal { -5 try-test3 -> 10 } { 5 try-test3 -> 6 } + +\ fcopysign + +t{ 5e 1e fcopysign -> 5e }t +t{ -5e 1e fcopysign -> 5e }t +t{ 5e -1e fcopysign -> -5e }t +t{ -5e -1e fcopysign -> -5e }t +\ tests involving -0e? + +\ ?of + +: sgn ( n1 -- n2 ) + case + dup 0< ?of drop -1 endof + dup 0> ?of drop 1 endof + dup + endcase ; + +t{ 5 sgn -> 1 } +t{ -3 sgn -> -1 } +t{ 0 sgn -> 0 }