• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

練習用です。いろんなものがごちゃまぜです。


Commit MetaInfo

Revision82 (tree)
Time2015-11-21 17:24:45
Authorbellyoshi

Log Message

single型のビット分析

Change Summary

Incremental Difference

--- vb2010/vb2010/Form1.Designer.vb (revision 81)
+++ vb2010/vb2010/Form1.Designer.vb (revision 82)
@@ -22,19 +22,9 @@
2222 'コード エディターを使って変更しないでください。
2323 <System.Diagnostics.DebuggerStepThrough()> _
2424 Private Sub InitializeComponent()
25- Me.ListBox1 = New System.Windows.Forms.ListBox()
2625 Me.Button1 = New System.Windows.Forms.Button()
2726 Me.SuspendLayout()
2827 '
29- 'ListBox1
30- '
31- Me.ListBox1.FormattingEnabled = True
32- Me.ListBox1.ItemHeight = 15
33- Me.ListBox1.Location = New System.Drawing.Point(12, 66)
34- Me.ListBox1.Name = "ListBox1"
35- Me.ListBox1.Size = New System.Drawing.Size(258, 184)
36- Me.ListBox1.TabIndex = 0
37- '
3828 'Button1
3929 '
4030 Me.Button1.Location = New System.Drawing.Point(12, 26)
@@ -48,15 +38,12 @@
4838 '
4939 Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
5040 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
51- Me.ClientSize = New System.Drawing.Size(282, 253)
41+ Me.ClientSize = New System.Drawing.Size(282, 79)
5242 Me.Controls.Add(Me.Button1)
53- Me.Controls.Add(Me.ListBox1)
5443 Me.Name = "Form1"
5544 Me.Text = "Form1"
5645 Me.ResumeLayout(False)
5746
5847 End Sub
59-
60- Friend WithEvents ListBox1 As ListBox
6148 Friend WithEvents Button1 As Button
6249 End Class
--- vb2010/vb2010/Form2.Designer.vb (nonexistent)
+++ vb2010/vb2010/Form2.Designer.vb (revision 82)
@@ -0,0 +1,62 @@
1+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
2+Partial Class Form2
3+ Inherits System.Windows.Forms.Form
4+
5+ 'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。
6+ <System.Diagnostics.DebuggerNonUserCode()> _
7+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8+ Try
9+ If disposing AndAlso components IsNot Nothing Then
10+ components.Dispose()
11+ End If
12+ Finally
13+ MyBase.Dispose(disposing)
14+ End Try
15+ End Sub
16+
17+ 'Windows フォーム デザイナーで必要です。
18+ Private components As System.ComponentModel.IContainer
19+
20+ 'メモ: 以下のプロシージャは Windows フォーム デザイナーで必要です。
21+ 'Windows フォーム デザイナーを使用して変更できます。
22+ 'コード エディターを使って変更しないでください。
23+ <System.Diagnostics.DebuggerStepThrough()> _
24+ Private Sub InitializeComponent()
25+ Me.Button1 = New System.Windows.Forms.Button()
26+ Me.ListBox1 = New System.Windows.Forms.ListBox()
27+ Me.SuspendLayout()
28+ '
29+ 'Button1
30+ '
31+ Me.Button1.Location = New System.Drawing.Point(22, 12)
32+ Me.Button1.Name = "Button1"
33+ Me.Button1.Size = New System.Drawing.Size(75, 23)
34+ Me.Button1.TabIndex = 0
35+ Me.Button1.Text = "Button1"
36+ Me.Button1.UseVisualStyleBackColor = True
37+ '
38+ 'ListBox1
39+ '
40+ Me.ListBox1.FormattingEnabled = True
41+ Me.ListBox1.ItemHeight = 15
42+ Me.ListBox1.Location = New System.Drawing.Point(22, 41)
43+ Me.ListBox1.Name = "ListBox1"
44+ Me.ListBox1.Size = New System.Drawing.Size(407, 94)
45+ Me.ListBox1.TabIndex = 1
46+ '
47+ 'Form2
48+ '
49+ Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
50+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
51+ Me.ClientSize = New System.Drawing.Size(497, 165)
52+ Me.Controls.Add(Me.ListBox1)
53+ Me.Controls.Add(Me.Button1)
54+ Me.Name = "Form2"
55+ Me.Text = "Form2"
56+ Me.ResumeLayout(False)
57+
58+ End Sub
59+
60+ Friend WithEvents Button1 As Button
61+ Friend WithEvents ListBox1 As ListBox
62+End Class
--- vb2010/vb2010/Form2.vb (nonexistent)
+++ vb2010/vb2010/Form2.vb (revision 82)
@@ -0,0 +1,56 @@
1+Public Class Form2
2+ Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
3+ Dim data As Single = 1.6F
4+ Dim buff(3) As Byte
5+ Dim mem As New System.IO.MemoryStream(buff)
6+ Dim br As New System.IO.BinaryWriter(mem)
7+ br.Write(data)
8+ br.Close()
9+ mem.Close()
10+
11+ Dim bufLastIdx = buff.Length - 1
12+ Dim str As String = ByteTobitString(bufLastIdx)
13+ For i As Integer = bufLastIdx - 1 To 0 Step -1
14+ str += " " & ByteTobitString(buff(i))
15+ Next
16+ ListBox1.Items.Add($"1.6 = '{str}'")
17+
18+ Dim result As Decimal
19+ result = CalcFrac("10011001100110011001011")
20+ ListBox1.Items.Add(result)
21+ result = CalcFrac("10011001100110011001100")
22+ ListBox1.Items.Add(result)
23+ result = CalcFrac("10011001100110011001101")
24+ ListBox1.Items.Add(result)
25+ result = CalcFrac("10011001100110011001110")
26+ ListBox1.Items.Add(result)
27+ result = CalcFrac("10011001100110011001111")
28+ ListBox1.Items.Add(result)
29+
30+ End Sub
31+
32+ Private Function ByteTobitString(ByVal b As Byte) As String
33+ Dim ret As String = "--------"
34+ For i As Integer = 1 To 8
35+ If (b And &H80) = &H80 Then
36+ Mid(ret, i) = "1"c
37+ Else
38+ Mid(ret, i) = "0"c
39+ End If
40+ b <<= 1
41+ Next
42+ Return ret
43+ End Function
44+
45+ Private Function CalcFrac(ByVal str As String) As Decimal
46+ Dim digit As Decimal = 0.5D
47+ Dim result As Decimal = 0D
48+ For Each c In str
49+ If c = "1"c Then
50+ result += digit
51+ End If
52+ digit /= 2D
53+ Next
54+ Return result
55+ End Function
56+End Class
\ No newline at end of file
--- vb2010/vb2010/My Project/Application.Designer.vb (revision 81)
+++ vb2010/vb2010/My Project/Application.Designer.vb (revision 82)
@@ -1,10 +1,10 @@
11 '------------------------------------------------------------------------------
22 ' <auto-generated>
3-' This code was generated by a tool.
4-' Runtime Version:4.0.30319.42000
3+' このコードはツールによって生成されました。
4+' ランタイム バージョン:4.0.30319.42000
55 '
6-' Changes to this file may cause incorrect behavior and will be lost if
7-' the code is regenerated.
6+' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7+' コードが再生成されるときに損失したりします。
88 ' </auto-generated>
99 '------------------------------------------------------------------------------
1010
@@ -13,15 +13,15 @@
1313
1414
1515 Namespace My
16-
17- 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18- ' or if you encounter build errors in this file, go to the Project Designer
19- ' (go to Project Properties or double-click the My Project node in
20- ' Solution Explorer), and make changes on the Application tab.
16+
17+ 'メモ: このファイルは自動生成されました。直接変更しないでください。変更したり、
18+ ' ビルド エラーが発生した場合は、プロジェクト デザイナー へ移動し (プロジェクト
19+ ' プロパティに移動するか、またはソリューション エクスプローラーのマイ プロジェクト
20+ ' ノード上でダブルクリック)、アプリケーション タブ上で変更を行います。
2121 '
2222 Partial Friend Class MyApplication
23-
24- <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
23+
24+ <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
2525 Public Sub New()
2626 MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
2727 Me.IsSingleInstance = false
@@ -29,10 +29,10 @@
2929 Me.SaveMySettingsOnExit = true
3030 Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
3131 End Sub
32-
33- <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
32+
33+ <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
3434 Protected Overrides Sub OnCreateMainForm()
35- Me.MainForm = Global.vb2010.Form1
35+ Me.MainForm = Global.vb2010.frmMenu
3636 End Sub
3737 End Class
3838 End Namespace
--- vb2010/vb2010/frmMenu.Designer.vb (nonexistent)
+++ vb2010/vb2010/frmMenu.Designer.vb (revision 82)
@@ -0,0 +1,86 @@
1+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
2+Partial Class frmMenu
3+ Inherits System.Windows.Forms.Form
4+
5+ 'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。
6+ <System.Diagnostics.DebuggerNonUserCode()> _
7+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8+ Try
9+ If disposing AndAlso components IsNot Nothing Then
10+ components.Dispose()
11+ End If
12+ Finally
13+ MyBase.Dispose(disposing)
14+ End Try
15+ End Sub
16+
17+ 'Windows フォーム デザイナーで必要です。
18+ Private components As System.ComponentModel.IContainer
19+
20+ 'メモ: 以下のプロシージャは Windows フォーム デザイナーで必要です。
21+ 'Windows フォーム デザイナーを使用して変更できます。
22+ 'コード エディターを使って変更しないでください。
23+ <System.Diagnostics.DebuggerStepThrough()> _
24+ Private Sub InitializeComponent()
25+ Me.Button1 = New System.Windows.Forms.Button()
26+ Me.Button2 = New System.Windows.Forms.Button()
27+ Me.Button3 = New System.Windows.Forms.Button()
28+ Me.Button4 = New System.Windows.Forms.Button()
29+ Me.SuspendLayout()
30+ '
31+ 'Button1
32+ '
33+ Me.Button1.Location = New System.Drawing.Point(26, 22)
34+ Me.Button1.Name = "Button1"
35+ Me.Button1.Size = New System.Drawing.Size(108, 23)
36+ Me.Button1.TabIndex = 0
37+ Me.Button1.Text = "1.6を200回"
38+ Me.Button1.UseVisualStyleBackColor = True
39+ '
40+ 'Button2
41+ '
42+ Me.Button2.Location = New System.Drawing.Point(26, 51)
43+ Me.Button2.Name = "Button2"
44+ Me.Button2.Size = New System.Drawing.Size(157, 23)
45+ Me.Button2.TabIndex = 0
46+ Me.Button2.Text = "Singled型のビット分析"
47+ Me.Button2.UseVisualStyleBackColor = True
48+ '
49+ 'Button3
50+ '
51+ Me.Button3.Location = New System.Drawing.Point(59, 120)
52+ Me.Button3.Name = "Button3"
53+ Me.Button3.Size = New System.Drawing.Size(75, 23)
54+ Me.Button3.TabIndex = 0
55+ Me.Button3.Text = "Button1"
56+ Me.Button3.UseVisualStyleBackColor = True
57+ '
58+ 'Button4
59+ '
60+ Me.Button4.Location = New System.Drawing.Point(59, 149)
61+ Me.Button4.Name = "Button4"
62+ Me.Button4.Size = New System.Drawing.Size(75, 23)
63+ Me.Button4.TabIndex = 0
64+ Me.Button4.Text = "Button1"
65+ Me.Button4.UseVisualStyleBackColor = True
66+ '
67+ 'frmMenu
68+ '
69+ Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
70+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
71+ Me.ClientSize = New System.Drawing.Size(747, 253)
72+ Me.Controls.Add(Me.Button4)
73+ Me.Controls.Add(Me.Button3)
74+ Me.Controls.Add(Me.Button2)
75+ Me.Controls.Add(Me.Button1)
76+ Me.Name = "frmMenu"
77+ Me.Text = "frmMenu"
78+ Me.ResumeLayout(False)
79+
80+ End Sub
81+
82+ Friend WithEvents Button1 As Button
83+ Friend WithEvents Button2 As Button
84+ Friend WithEvents Button3 As Button
85+ Friend WithEvents Button4 As Button
86+End Class
--- vb2010/vb2010/frmMenu.vb (nonexistent)
+++ vb2010/vb2010/frmMenu.vb (revision 82)
@@ -0,0 +1,9 @@
1+Public Class frmMenu
2+ Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
3+ Form1.Show()
4+ End Sub
5+
6+ Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
7+ Form2.Show()
8+ End Sub
9+End Class
\ No newline at end of file