Changeset 127 for CoolStreaming/Demo/DynNumber/UMainForm.pas
- Timestamp:
- Jan 16, 2011, 3:08:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolStreaming/Demo/DynNumber/UMainForm.pas
r126 r127 51 51 ListView1.BeginUpdate; 52 52 ListView1.Clear; 53 for I := 0 to 1 6do begin53 for I := 0 to 10000 do begin 54 54 N.Stream.Size := 0; 55 55 N.Write(I); … … 60 60 NewItem := ListView1.Items.Add; 61 61 NewItem.Caption := IntToStr(I); 62 NewItem.SubItems.Add(''); 62 J := Floor(Log2(I)) + 1; 63 NewItem.SubItems.Add(FloatToStr(Round((1 - (J / N.Stream.Size)) * 100) / 100)); 63 64 NewItem.SubItems.Add(Line); 64 65 end; … … 72 73 var 73 74 I: Integer; 75 II: Integer; 74 76 Count: Integer; 75 77 Parts: array of Integer; … … 80 82 NewItem: TListItem; 81 83 N: TDynamicNumber; 84 const 85 Step = 1; 82 86 begin 83 87 Count := 1; … … 87 91 ListView1.BeginUpdate; 88 92 ListView1.Clear; 89 for I := 0 to 1000 do begin90 93 for II := 0 to 20000 do begin 94 I := II * Step; 91 95 // Write 92 96 N.Stream.Size := 0; … … 104 108 NewItem.Caption := IntToStr(I); 105 109 J := Floor(Log2(I)) + 1; 106 NewItem.SubItems.Add(FloatToStr( 1 - (J / N.Stream.Size)));110 NewItem.SubItems.Add(FloatToStr(Round((1 - (J / N.Stream.Size)) * 100) / 100)); 107 111 Line := ''; 108 112 N.Stream.Position := 0; … … 112 116 113 117 // Increment value 118 for J := 0 to Step - 1 do begin 114 119 PartIndex := Count - 1; 115 120 repeat 116 121 Parts[PartIndex] := Parts[PartIndex] + 1; 117 if PartIndex > 0 then MaxValue := 1 shl (Parts[PartIndex - 1] + 1 )122 if PartIndex > 0 then MaxValue := 1 shl (Parts[PartIndex - 1] + 1 + PartIndex) 118 123 else MaxValue := 2; 119 124 if Parts[PartIndex] >= MaxValue then begin … … 129 134 end else Break; 130 135 until False; 136 end; 131 137 end; 132 138 finally
Note:
See TracChangeset
for help on using the changeset viewer.