Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is my Decimals.cls (VB6):</p> <pre><code>VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "Decimals" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes" Attribute VB_Ext_KEY = "Top_Level" ,"Yes" Option Explicit 'local variable(s) to hold property value(s) Private mvarDec As Variant 'local copy Public Property Let Dec(ByVal vData As Variant) 'used when assigning a value to the property, on the left side of an assignment. 'Syntax: X.Dec = 5 mvarDec = CDec(vData) End Property Public Property Get Dec() As Variant Attribute Dec.VB_UserMemId = 0 'used when retrieving value of a property, on the right side of an assignment. 'Syntax: Debug.Print X.Dec Dec = CDec(mvarDec) End Property </code></pre> <p>and this is a testing program. The class has been setup so that you don't have to qualify with .Dec() on get and let.</p> <pre><code>Dim dec1 As New Std.Decimals Dim dec2 As New Std.Decimals Dim dec3 As New Std.Decimals Dim modulus As New Std.Decimals Sub main() dec1 = "1000.000000001" dec2 = "1000.00000000000001" dec3 = dec1 + dec2 Debug.Print dec1 Debug.Print dec2 Debug.Print dec3 Debug.Print dec3 * dec3 Debug.Print dec3 / 10 Debug.Print dec3 / 100 Debug.Print Sqr(dec3) modulus = dec1 - Int(dec1 / dec2) * dec2 Debug.Print modulus End Sub </code></pre> <p>and sample run</p> <pre><code> 1000.000000001 1000.00000000000001 2000.00000000100001 4000000.000004000040000001 200.000000000100001 20.0000000000100001 44.721359550007 0.00000000099999 1000.000000001 1000.00000000000001 2000.00000000100001 4000000.000004000040000001 200.000000000100001 20.0000000000100001 44.721359550007 0.00000000099999 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload