#
# kihon9.rb
#   $Id: kihon9.rb,v 1.2 2000/11/18 19:03:33 keiko Exp $
#


require "narray"
require "numru/dcl"
include NumRu
include NMath


nmax = 40
xmin = 0.0
xmax = 4*PI
ymin = -1.0
ymax = 1.0

x = NArray.sfloat(nmax+1)
y = NArray.sfloat(nmax+1)

#-- data ---
dt = xmax/nmax
x = x.indgen * dt
y = sin(x)

#-- graph ---
iws = (ARGV[0] || (puts ' WORKSTATION ID (I)  ? ;'; DCL::sgpwsn; gets)).to_i
DCL::sgopn iws

DCL::sgfrm

#--  ラインタイプ = 4 (デフォルト) ----
DCL::sgswnd(xmin, xmax, ymin, ymax)
DCL::sgsvpt(0.0, 1.0, 0.7, 0.9)
DCL::sgstrn(1)
DCL::sgstrf

DCL::sgsplt(4)
DCL::sgplu(x, y)

#--  ラインタイプ = 4 (BITLEN*2) ----
DCL::sgswnd(xmin, xmax, ymin, ymax)
DCL::sgsvpt(0.0, 1.0, 0.5, 0.7)
DCL::sgstrn(1)
DCL::sgstrf

DCL::sgrset('BITLEN', 0.006)
DCL::sgplu(x, y)

DCL::sgrset('BITLEN', 0.003)

#--  ビットパターン ----
DCL::sgswnd(xmin, xmax, ymin, ymax)
DCL::sgsvpt(0.0, 1.0, 0.3, 0.5)
DCL::sgstrn(1)
DCL::sgstrf

#itype = bitpci('1111111100100100')
itype = '0b1111111100100100'.oct
DCL::sgsplt(itype)
DCL::sgplu(x, y)

#--  ビットパターン(倍長) ----
DCL::sgswnd(xmin, xmax, ymin, ymax)
DCL::sgsvpt(0.0, 1.0, 0.1, 0.3)
DCL::sgstrn(1)
DCL::sgstrf

DCL::sgiset('NBITS', 32)
#itype = bitpci('10010010011111000111110001111100')
itype =  '0b10010010011111000111110001111100'.oct -  ('0b1' + "0"*32).oct 
DCL::sgsplt(itype)
DCL::sgplu(x, y)

DCL::sgcls



syntax highlighted by Code2HTML, v. 0.9.1