Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #131683

Test REPRESENT corner cases

Date 2024-07-05 00:04 +1000
Newsgroups comp.lang.forth
From dxf <dxforth@gmail.com>
Subject Test REPRESENT corner cases
Message-ID <6686abec$1@news.ausics.net> (permalink)
Organization Ausics - https://newsgroups.ausics.net

Show all headers | View raw


Test REPRESENT corner cases 

: t0 ( r u -- )
  pad 16 [char] x fill
  pad swap represent drop
  swap cr ." Exp: " . ."  Sign: " . pad 16 dump ;

\ Ideally it rounds-down to 0.0
: t1 ( -- )  0.4e 0 t0 ;

\ Ideally it rounds-up to 1.0
: t2 ( -- )  0.9e 0 t0 ;

\ Ideally it returns the full string -Inf
: t3 ( -- )  -1e 0e f/ 1 t0 ;

: testall  t1 t2 t3 ;

testall


--
Win32Forth: a 32 Bit Forth for Windows 95/98/ME/NT4/W2K/XP/VISTA/W7/W8/W10
Version: 6.15.05 Build: 4 

testall 
Exp: 0  Sign: 0 
  195FE0 | 34 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78 |4xxxxxxxxxxxxxxx|
Exp: 0  Sign: 0 
  195FE0 | 39 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78 |9xxxxxxxxxxxxxxx|
Exp: 2147483647  Sign: -1 
  195FE0 | 49 78 78 78 78 78 78 78  78 78 78 78 78 78 78 78 |Ixxxxxxxxxxxxxxx| ok
  ok

--
NT/FORTH (C) 2005  Peter Fälth  Version 1.6-983-824 Compiled on 2017-12-03

testall
Exp: 1  Sign: 0
 Address  0  1  2  3   4  5  6  7   8  9  A  B   C  D  E  F  |0123456789ABCDEF|
013F1120                            30 78 78 78  78 78 78 78 |........0xxxxxxx|
013F1130  78 78 78 78  78 78 78 78                           |xxxxxxxx........|

Exp: 1  Sign: 0
 Address  0  1  2  3   4  5  6  7   8  9  A  B   C  D  E  F  |0123456789ABCDEF|
013F1120                            31 78 78 78  78 78 78 78 |........1xxxxxxx|
013F1130  78 78 78 78  78 78 78 78                           |xxxxxxxx........|

Exp: 0  Sign: 0
 Address  0  1  2  3   4  5  6  7   8  9  A  B   C  D  E  F  |0123456789ABCDEF|
013F1120                            2D 78 78 78  78 78 78 78 |........-xxxxxxx|
013F1130  78 78 78 78  78 78 78 78                           |xxxxxxxx........|
 ok

--
 VFX Forth 64 for Windows x64
  © MicroProcessor Engineering Ltd, 1998-2023 
 Version: 5.43 [build 4241]
 Build date: 22 December 2023

testall 
Exp: 1  Sign: 0 
0000:0000:01C2:EB00  30 30 30 30 30 30 30 30  30 30 30 30 30 30 30 30  0000000000000000

Exp: 1  Sign: 0 
0000:0000:01C2:EB00  31 30 30 30 30 30 30 30  30 30 30 30 30 30 30 30  1000000000000000

Exp: 3  Sign: -1 
0000:0000:01C2:EB00  49 6E 66 20 20 20 20 20  20 20 20 20 20 20 20 20  Inf             
 ok
NDP Potential Exception: NDP SW = 0524 

Back to comp.lang.forth | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Test REPRESENT corner cases dxf <dxforth@gmail.com> - 2024-07-05 00:04 +1000
  Re: Test REPRESENT corner cases Hans Bezemer <the.beez.speaks@gmail.com> - 2024-07-06 15:28 +0200
    Re: Test REPRESENT corner cases dxf <dxforth@gmail.com> - 2024-07-07 13:08 +1000

csiph-web