home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1997 September / Macworld (1997-09).dmg / Serious Software / Cherwell Scientific Demos / pro Fit / pro Fit 5.0 demo (ppc).sea / pro Fit 5.0 demo (ppc) / Examples / Programming - intro / Test equality < prev   
MacBinary  |  1996-04-15  |  2.4 KB  |  [ftFC/NLft]

view JSON data     |     view as text     |     open on a Mac     |     open on a PC

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: Test equality

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Mon Apr 15 13:03:54 1996, modified Mon Apr 15 13:03:54 1996, creator 'NLft', type 'ftFC', 1316 bytes "Test equality" , at 0x5a4 815 bytes resource default (weak)
99% file data default
100% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[ftFC]
macFileCreator[NLft]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0d 54 65 73 74 20 65 | 71 75 61 6c 69 74 79 00 |..Test e|quality.|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 66 74 46 43 4e 4c 66 | 74 01 00 00 00 00 00 00 |.ftFCNLf|t.......|
|00000050| 00 00 00 00 00 05 24 00 | 00 03 2f ad 98 31 fa ad |......$.|../..1..|
|00000060| 98 31 fa 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.1......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ee 9c 00 00 |........|........|
|00000080| 7b 0d 54 68 69 73 20 69 | 73 20 61 20 73 69 6d 70 |{.This i|s a simp|
|00000090| 6c 65 20 65 78 61 6d 70 | 6c 65 20 74 68 61 74 20 |le examp|le that |
|000000a0| 73 68 6f 77 73 20 68 6f | 77 20 74 6f 20 61 63 63 |shows ho|w to acc|
|000000b0| 65 73 73 20 74 68 65 20 | 64 61 74 61 20 77 69 6e |ess the |data win|
|000000c0| 64 6f 77 0d 66 72 6f 6d | 20 61 20 70 72 6f 67 72 |dow.from| a progr|
|000000d0| 61 6d 2e 20 54 6f 20 72 | 75 6e 20 74 68 65 20 70 |am. To r|un the p|
|000000e0| 72 6f 67 72 61 6d 2c 20 | 63 6c 69 63 6b 20 74 68 |rogram, |click th|
|000000f0| 65 20 62 75 74 74 6f 6e | 20 22 41 64 64 22 2c 20 |e button| "Add", |
|00000100| 74 68 65 6e 20 63 68 6f | 6f 73 65 0d 74 68 65 20 |then cho|ose.the |
|00000110| 70 72 6f 67 72 61 6d 20 | 22 44 61 74 61 54 65 73 |program |"DataTes|
|00000120| 74 22 20 66 72 6f 6d 20 | 74 68 65 20 6d 65 6e 75 |t" from |the menu|
|00000130| 20 22 4d 69 73 63 22 2e | 0d 0d 54 68 69 73 20 70 | "Misc".|..This p|
|00000140| 72 6f 67 72 61 6d 20 63 | 6f 6d 70 61 72 65 73 20 |rogram c|ompares |
|00000150| 74 68 65 20 6e 75 6d 62 | 65 72 73 20 69 6e 20 74 |the numb|ers in t|
|00000160| 68 65 20 66 69 72 73 74 | 20 74 77 6f 20 63 6f 6c |he first| two col|
|00000170| 75 6d 6e 73 20 6f 66 20 | 74 68 65 0d 66 72 6f 6e |umns of |the.fron|
|00000180| 74 6d 6f 73 74 20 64 61 | 74 61 20 77 69 6e 64 6f |tmost da|ta windo|
|00000190| 77 20 61 6e 64 20 77 72 | 69 74 65 73 20 27 31 27 |w and wr|ites '1'|
|000001a0| 20 69 6e 20 74 68 65 20 | 74 68 69 72 64 20 63 6f | in the |third co|
|000001b0| 6c 75 6d 6e 20 69 66 20 | 74 68 65 79 20 61 72 65 |lumn if |they are|
|000001c0| 0d 65 71 75 61 6c 2e 20 | 4f 74 68 65 72 77 69 73 |.equal. |Otherwis|
|000001d0| 65 20 69 74 20 77 72 69 | 74 65 73 20 61 20 7a 65 |e it wri|tes a ze|
|000001e0| 72 6f 2e 20 49 66 20 74 | 68 65 20 63 65 6c 6c 73 |ro. If t|he cells|
|000001f0| 20 6f 66 20 74 68 65 20 | 66 69 72 73 74 20 74 77 | of the |first tw|
|00000200| 6f 20 63 6f 6c 75 6d 6e | 73 0d 61 72 65 20 65 6d |o column|s.are em|
|00000210| 70 74 79 2c 20 69 74 20 | 65 72 61 73 65 73 20 74 |pty, it |erases t|
|00000220| 68 65 20 63 6f 72 72 65 | 73 70 6f 6e 64 69 6e 67 |he corre|sponding|
|00000230| 20 63 65 6c 6c 20 69 6e | 20 74 68 65 20 74 68 69 | cell in| the thi|
|00000240| 72 64 20 63 6f 6c 75 6d | 6e 2e 20 57 68 65 6e 0d |rd colum|n. When.|
|00000250| 69 74 20 68 61 73 20 66 | 69 6e 69 73 68 65 64 2c |it has f|inished,|
|00000260| 20 69 74 20 77 72 69 74 | 65 73 20 74 68 65 20 73 | it writ|es the s|
|00000270| 74 72 69 6e 67 20 27 64 | 6f 6e 65 27 20 69 6e 74 |tring 'd|one' int|
|00000280| 6f 20 74 68 65 20 72 65 | 73 75 6c 74 73 20 77 69 |o the re|sults wi|
|00000290| 6e 64 6f 77 2e 0d 7d 0d | 0d 70 72 6f 67 72 61 6d |ndow..}.|.program|
|000002a0| 20 44 61 74 61 54 65 73 | 74 3b 0d 0d 76 61 72 20 | DataTes|t;..var |
|000002b0| 69 3a 20 69 6e 74 65 67 | 65 72 3b 0d 0d 20 20 66 |i: integ|er;.. f|
|000002c0| 75 6e 63 74 69 6f 6e 20 | 54 65 73 74 45 71 75 61 |unction |TestEqua|
|000002d0| 6c 69 74 79 28 78 2c 79 | 3a 72 65 61 6c 29 3a 42 |lity(x,y|:real):B|
|000002e0| 6f 6f 6c 65 61 6e 3b 0d | 20 20 20 20 7b 20 72 65 |oolean;.| { re|
|000002f0| 74 75 72 6e 73 20 74 72 | 75 65 20 69 66 20 78 20 |turns tr|ue if x |
|00000300| 61 6e 64 20 79 20 61 72 | 65 20 65 71 75 61 6c 20 |and y ar|e equal |
|00000310| 6f 72 20 6e 65 61 72 6c | 79 20 65 71 75 61 6c 20 |or nearl|y equal |
|00000320| 7d 0d 20 20 20 20 20 63 | 6f 6e 73 74 20 65 70 73 |}. c|onst eps|
|00000330| 69 6c 6f 6e 20 3d 31 65 | 2d 37 3b 0d 20 20 62 65 |ilon =1e|-7;. be|
|00000340| 67 69 6e 0d 20 20 20 20 | 69 66 20 28 78 3d 30 29 |gin. |if (x=0)|
|00000350| 20 61 6e 64 20 28 79 3d | 30 29 20 74 68 65 6e 20 | and (y=|0) then |
|00000360| 54 65 73 74 45 71 75 61 | 6c 69 74 79 20 3a 3d 20 |TestEqua|lity := |
|00000370| 74 72 75 65 0d 20 20 20 | 20 65 6c 73 65 20 54 65 |true. | else Te|
|00000380| 73 74 45 71 75 61 6c 69 | 74 79 20 3a 3d 20 61 62 |stEquali|ty := ab|
|00000390| 73 28 61 62 73 28 78 29 | 2d 61 62 73 28 79 29 29 |s(abs(x)|-abs(y))|
|000003a0| 2f 28 61 62 73 28 78 29 | 2b 61 62 73 28 79 29 29 |/(abs(x)|+abs(y))|
|000003b0| 20 3c 20 65 70 73 69 6c | 6f 6e 3b 0d 20 20 65 6e | < epsil|on;. en|
|000003c0| 64 3b 0d 0d 62 65 67 69 | 6e 0d 20 20 66 6f 72 20 |d;..begi|n. for |
|000003d0| 69 20 3a 3d 20 31 20 74 | 6f 20 6e 72 52 6f 77 73 |i := 1 t|o nrRows|
|000003e0| 20 64 6f 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | do | |
|000003f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 6c 6f | | {lo|
|00000400| 6f 70 20 74 68 72 6f 75 | 67 68 20 61 6c 6c 20 72 |op throu|gh all r|
|00000410| 6f 77 73 7d 0d 20 20 20 | 20 69 66 20 44 61 74 61 |ows}. | if Data|
|00000420| 4f 4b 28 69 2c 31 29 20 | 61 6e 64 20 44 61 74 61 |OK(i,1) |and Data|
|00000430| 4f 4b 28 69 2c 32 29 20 | 74 68 65 6e 20 20 20 20 |OK(i,2) |then |
|00000440| 20 20 20 20 20 20 20 20 | 7b 69 66 20 74 68 65 72 | |{if ther|
|00000450| 65 20 69 73 20 64 61 74 | 61 20 69 6e 20 62 6f 74 |e is dat|a in bot|
|00000460| 68 20 63 6f 6c 75 6d 6e | 73 7d 0d 20 20 20 20 09 |h column|s}. .|
|00000470| 09 62 65 67 69 6e 0d 09 | 09 20 20 20 20 09 09 69 |.begin..|. ..i|
|00000480| 66 20 54 65 73 74 45 71 | 75 61 6c 69 74 79 28 64 |f TestEq|uality(d|
|00000490| 61 74 61 5b 69 2c 31 5d | 2c 64 61 74 61 5b 69 2c |ata[i,1]|,data[i,|
|000004a0| 32 5d 29 20 74 68 65 6e | 20 20 7b 69 66 20 74 68 |2]) then| {if th|
|000004b0| 65 20 74 77 6f 20 63 6f | 6c 75 6d 6e 73 20 61 72 |e two co|lumns ar|
|000004c0| 65 20 73 75 62 73 74 61 | 6e 74 69 61 6c 6c 79 20 |e substa|ntially |
|000004d0| 65 71 75 61 6c 7d 0d 20 | 20 20 20 20 20 20 20 09 |equal}. | .|
|000004e0| 09 20 20 20 64 61 74 61 | 5b 69 2c 33 5d 20 3a 3d |. data|[i,3] :=|
|000004f0| 20 31 0d 20 20 20 09 09 | 20 20 20 20 65 6c 73 65 | 1. ..| else|
|00000500| 20 64 61 74 61 5b 69 2c | 33 5d 20 3a 3d 20 30 3b | data[i,|3] := 0;|
|00000510| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000520| 20 20 20 20 20 20 7b 69 | 66 20 6e 6f 74 20 65 71 | {i|f not eq|
|00000530| 75 61 6c 7d 0d 09 09 20 | 20 20 20 20 65 6e 64 0d |ual}... | end.|
|00000540| 20 20 20 20 20 09 65 6c | 73 65 20 43 6c 65 61 72 | .el|se Clear|
|00000550| 44 61 74 61 28 69 2c 33 | 29 3b 20 20 20 20 20 20 |Data(i,3|); |
|00000560| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000570| 20 20 20 7b 65 72 61 73 | 65 20 63 65 6c 6c 20 69 | {eras|e cell i|
|00000580| 6e 20 63 6f 6c 75 6d 6e | 20 33 7d 0d 20 20 57 72 |n column| 3}. Wr|
|00000590| 69 74 65 6c 6e 28 27 64 | 6f 6e 65 27 29 3b 0d 65 |iteln('d|one');.e|
|000005a0| 6e 64 3b 0d 00 00 00 00 | 00 00 00 00 00 00 00 00 |nd;.....|........|
|000005b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000600| 00 00 01 00 00 00 02 b9 | 00 00 01 b9 00 00 00 76 |........|.......v|
|00000610| 6c 65 20 65 78 61 6d 70 | 6c 65 20 74 68 61 74 20 |le examp|le that |
|00000620| 73 68 6f 77 73 20 68 6f | 77 20 74 6f 20 61 63 63 |shows ho|w to acc|
|00000630| 0d 54 65 73 74 20 65 71 | 75 61 6c 69 74 79 02 00 |.Test eq|uality..|
|00000640| 00 00 66 74 46 43 4e 4c | 66 74 01 00 00 00 00 00 |..ftFCNL|ft......|
|00000650| 00 00 66 74 46 43 4e 4c | 66 74 01 00 00 00 00 00 |..ftFCNL|ft......|
|00000660| 00 00 00 00 00 00 00 00 | 00 00 80 00 00 00 00 00 |........|........|
|00000670| 00 00 a4 bb 55 2f 00 00 | 05 24 00 00 03 2f 2c 20 |....U/..|.$.../, |
|00000680| 74 68 65 6e 20 63 68 6f | 6f 73 65 0d 74 68 65 20 |then cho|ose.the |
|00000690| 70 72 6f 67 72 61 6d 20 | 22 44 61 74 61 54 65 73 |program |"DataTes|
|000006a0| 74 22 20 66 72 6f 6d 20 | 74 68 65 20 6d 65 6e 75 |t" from |the menu|
|000006b0| 20 22 4d 69 73 63 22 2e | 0d 0d 54 68 69 73 20 70 | "Misc".|..This p|
|000006c0| 72 6f 67 72 61 6d 20 63 | 6f 6d 70 61 72 65 73 20 |rogram c|ompares |
|000006d0| 74 68 65 20 6e 75 6d 62 | 65 72 73 20 69 6e 20 74 |the numb|ers in t|
|000006e0| 68 65 20 66 69 72 73 74 | 20 74 77 6f 20 63 6f 6c |he first| two col|
|000006f0| 75 6d 6e 73 20 6f 66 20 | 74 68 65 0d 66 72 6f 6e |umns of |the.fron|
|00000700| 00 00 00 08 00 29 00 02 | 01 f7 02 5b 00 00 01 06 |.....)..|...[....|
|00000710| 00 04 00 09 00 00 06 4d | 6f 6e 61 63 6f 80 02 63 |.......M|onaco..c|
|00000720| 04 00 02 58 58 70 02 87 | f7 70 22 00 08 28 40 a1 |...XXp..|.p"..(@.|
|00000730| 27 a0 00 51 08 f0 02 87 | f7 e0 00 01 d9 94 00 0b |'..Q....|........|
|00000740| 00 06 00 0b 00 06 00 00 | 00 81 02 62 75 40 00 00 |........|...bu@..|
|00000750| 00 00 02 62 6b 04 00 00 | 00 81 02 62 75 40 00 00 |...bk...|...bu@..|
|00000760| 00 00 ff ff ff ff 02 87 | f8 c0 00 0c f3 54 03 22 |........|.....T."|
|00000770| 67 78 00 00 00 02 00 2a | 00 11 02 62 0d 80 02 87 |gx.....*|...b....|
|00000780| f7 a8 02 87 f8 00 02 87 | f8 a8 02 87 f8 18 00 00 |........|........|
|00000790| 34 b0 00 00 34 b0 02 62 | 68 d8 00 45 8c 80 00 45 |4...4..b|h..E...E|
|000007a0| 8c 40 02 6a 0e 4f 00 00 | 00 01 00 45 5d 70 02 62 |.@.j.O..|...E]p.b|
|000007b0| 84 78 00 00 00 04 00 00 | 00 00 40 88 c9 3c 00 00 |.x......|..@..<..|
|000007c0| 00 04 00 45 8c 50 00 00 | 00 04 00 0b 75 10 00 1a |...E.P..|....u...|
|000007d0| 8f 0c 00 1a 8f 00 02 87 | f8 50 48 00 04 28 00 1a |........|.PH..(..|
|000007e0| 0e 8c 00 00 00 02 02 87 | f8 30 00 1a 8f 24 00 1a |........|.0...$..|
|000007f0| f2 94 68 ff f7 40 02 87 | f8 50 00 01 2f a4 00 17 |..h..@..|.P../...|
|00000800| 47 1c 00 00 00 04 02 87 | f8 50 42 00 04 04 00 0b |G.......|.PB.....|
|00000810| 75 10 02 6a 0e 4f 00 00 | 00 10 00 00 00 00 00 00 |u..j.O..|........|
|00000820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 04 00 00 |........|........|
|00000830| 00 01 00 00 00 78 00 03 | 00 00 00 48 00 48 00 00 |.....x..|...H.H..|
|00000840| 00 00 02 da 02 28 ff e1 | ff e2 02 f9 02 46 03 47 |.....(..|.....F.G|
|00000850| 05 28 03 fc 00 02 00 00 | 00 48 00 48 00 00 00 00 |.(......|.H.H....|
|00000860| 02 da 02 28 00 01 00 00 | 00 64 00 00 00 01 00 01 |...(....|.d......|
|00000870| 01 01 00 00 00 01 27 0f | 00 01 00 01 00 00 00 00 |......'.|........|
|00000880| 00 00 00 00 00 00 00 00 | 00 02 00 19 01 90 00 00 |........|........|
|00000890| 00 00 00 40 00 00 00 00 | 00 00 00 00 00 01 00 00 |...@....|........|
|000008a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008b0| 00 07 06 70 72 6f 46 69 | 74 00 00 01 00 00 00 02 |...proFi|t.......|
|000008c0| b9 00 00 01 b9 00 00 00 | 76 02 62 9b fc 26 ee 00 |........|v.b..&..|
|000008d0| 00 00 1c 00 76 00 01 66 | 49 4e 46 00 04 00 12 53 |....v..f|INF....S|
|000008e0| 54 52 20 00 00 00 4e 00 | 81 ff ff 00 00 00 00 02 |TR ...N.|........|
|000008f0| 62 8c fc 00 82 ff ff 00 | 00 00 0c 02 63 00 20 00 |b.......|....c. .|
|00000900| 83 ff ff 00 00 01 16 02 | 63 00 54 00 85 ff ff 00 |........|c.T.....|
|00000910| 00 01 2a 02 62 ff bc 00 | 84 ff ff 00 00 01 32 02 |..*.b...|......2.|
|00000920| 62 91 5c bf f4 ff ff 00 | 00 01 ae 02 62 8d 10 00 |b.\.....|....b...|
|00000930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+