vb6parse 1.0.0

vb6parse is a library for parsing and analyzing VB6 code, from projects, to controls, to modules, and forms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="VB6Parse Library Reference - sqr - Math">
    <title>sqr - Math - VB6Parse Library Reference</title>
    <link rel="stylesheet" href="../../../assets/css/style.css">
    <link rel="stylesheet" href="../../../assets/css/docs-style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
    <script src="../../../assets/js/theme-switcher.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/vbnet.min.js"></script>
    <script>hljs.highlightAll();</script>
</head>
<body>
    <header class="docs-header">
        <div class="container">
            <h1><a href="../../../index.html">VB6Parse</a> / <a href="../../../library/index.html">Library</a> / <a href="../../../library/functions/math/index.html">Math</a> / sqr</h1>
            <p class="tagline">VB6 Library Reference</p>
        </div>
    </header>

    <nav class="docs-nav">
        <div class="container">
            <a href="../../../index.html">Home</a>
            <a href="../../../library/index.html">Library Reference</a>
            <a href="../../../documentation.html">Documentation</a>
            <a href="https://docs.rs/vb6parse" target="_blank">API Docs</a>
            <a href="https://github.com/scriptandcompile/vb6parse" target="_blank">GitHub</a>
            <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
                <span class="theme-icon">🌙</span>
            </button>
        </div>
    </nav>

    <main class="container">
        
        <article class="library-item">
            <h1 id="sqr-function">Sqr Function</h1>
<p>Returns a Double specifying the square root of a number.</p>
<h2 id="syntax">Syntax</h2>
<pre><code class="language-vbnet">Sqr(number)</code></pre>
<h2 id="parameters">Parameters</h2>
<ul>
<li><code>number</code> - Required. Double or any valid numeric expression greater than or equal to 0.</li>
</ul>
<h2 id="return-value">Return Value</h2>
<p>Returns a Double containing the square root of the number.</p>
<h2 id="remarks">Remarks</h2>
<p>The Sqr function calculates the positive square root of a non-negative number. It's one of the fundamental mathematical functions in VB6 and is commonly used in geometric calculations, statistical analysis, and scientific applications.
Key characteristics:
- Returns the positive (principal) square root only
- Argument must be &gt;= 0 (negative values cause Error 5)
- Returns Double for maximum precision
- Sqr(0) = 0
- Sqr(1) = 1
- Sqr(x) * Sqr(x) = x (within floating-point precision)
- Inverse operation of squaring: Sqr(x^2) = x (for x &gt;= 0)
Mathematical relationships:
- Sqr(x * y) = Sqr(x) * Sqr(y)
- Sqr(x / y) = Sqr(x) / Sqr(y)
- Sqr(x^2) = Abs(x)
- x^(1/2) = Sqr(x)
- x^(1/n) can be calculated as x^(1/n) = Exp(Log(x) / n)</p>
<h2 id="typical-uses">Typical Uses</h2>
<ol>
<li><strong>Distance Calculations</strong>: Calculate distance between two points</li>
<li><strong>Pythagorean Theorem</strong>: Find hypotenuse or sides of right triangles</li>
<li><strong>Standard Deviation</strong>: Statistical calculations</li>
<li><strong>Quadratic Equations</strong>: Solve equations using quadratic formula</li>
<li><strong>Normalization</strong>: Normalize vectors and values</li>
<li><strong>Root Mean Square</strong>: Calculate RMS values</li>
<li><strong>Geometric Calculations</strong>: Circle, sphere, and other shape calculations</li>
<li><strong>Physics Simulations</strong>: Velocity, acceleration, and energy calculations</li>
</ol>
<h2 id="basic-examples">Basic Examples</h2>
<pre><code class="language-vbnet">&#x27; Example 1: Calculate square root of a number
Dim result As Double
result = Sqr(25)
&#x27; Returns 5</code></pre>
<pre><code class="language-vbnet">&#x27; Example 2: Distance between two points (Pythagorean theorem)
Dim x1 As Double, y1 As Double
Dim x2 As Double, y2 As Double
Dim distance As Double
x1 = 0: y1 = 0
x2 = 3: y2 = 4
distance = Sqr((x2 - x1) ^ 2 + (y2 - y1) ^ 2)
&#x27; Returns 5</code></pre>
<pre><code class="language-vbnet">&#x27; Example 3: Calculate hypotenuse of right triangle
Dim sideA As Double
Dim sideB As Double
Dim hypotenuse As Double
sideA = 3
sideB = 4
hypotenuse = Sqr(sideA ^ 2 + sideB ^ 2)
&#x27; Returns 5</code></pre>
<pre><code class="language-vbnet">&#x27; Example 4: Quadratic formula
Dim a As Double, b As Double, c As Double
Dim discriminant As Double
Dim root1 As Double, root2 As Double
a = 1: b = -5: c = 6
discriminant = b ^ 2 - 4 * a * c
If discriminant &gt;= 0 Then
    root1 = (-b + Sqr(discriminant)) / (2 * a)
    root2 = (-b - Sqr(discriminant)) / (2 * a)
End If</code></pre>
<h2 id="common-patterns">Common Patterns</h2>
<h3 id="pattern-1-calculatedistance2d">Pattern 1: <code>CalculateDistance2D</code></h3>
<p>Calculate distance between two 2D points</p>
<pre><code class="language-vbnet">Function CalculateDistance2D(x1 As Double, y1 As Double, _
                             x2 As Double, y2 As Double) As Double
    Dim dx As Double
    Dim dy As Double
    dx = x2 - x1
    dy = y2 - y1
    CalculateDistance2D = Sqr(dx * dx + dy * dy)
End Function</code></pre>
<h3 id="pattern-2-calculatedistance3d">Pattern 2: <code>CalculateDistance3D</code></h3>
<p>Calculate distance between two 3D points</p>
<pre><code class="language-vbnet">Function CalculateDistance3D(x1 As Double, y1 As Double, z1 As Double, _
                             x2 As Double, y2 As Double, z2 As Double) As Double
    Dim dx As Double, dy As Double, dz As Double
    dx = x2 - x1
    dy = y2 - y1
    dz = z2 - z1
    CalculateDistance3D = Sqr(dx * dx + dy * dy + dz * dz)
End Function</code></pre>
<h3 id="pattern-3-calculatehypotenuse">Pattern 3: <code>CalculateHypotenuse</code></h3>
<p>Calculate hypotenuse of right triangle</p>
<pre><code class="language-vbnet">Function CalculateHypotenuse(sideA As Double, sideB As Double) As Double
    CalculateHypotenuse = Sqr(sideA ^ 2 + sideB ^ 2)
End Function</code></pre>
<h3 id="pattern-4-calculatestandarddeviation">Pattern 4: <code>CalculateStandardDeviation</code></h3>
<p>Calculate standard deviation of values</p>
<pre><code class="language-vbnet">Function CalculateStandardDeviation(values() As Double) As Double
    Dim i As Integer
    Dim sum As Double
    Dim mean As Double
    Dim sumSquaredDiff As Double
    Dim count As Integer
    count = UBound(values) - LBound(values) + 1
    &#x27; Calculate mean
    sum = 0
    For i = LBound(values) To UBound(values)
        sum = sum + values(i)
    Next i
    mean = sum / count
    &#x27; Calculate sum of squared differences
    sumSquaredDiff = 0
    For i = LBound(values) To UBound(values)
        sumSquaredDiff = sumSquaredDiff + (values(i) - mean) ^ 2
    Next i
    CalculateStandardDeviation = Sqr(sumSquaredDiff / count)
End Function</code></pre>
<h3 id="pattern-5-normalizevector">Pattern 5: <code>NormalizeVector</code></h3>
<p>Normalize a 2D vector</p>
<pre><code class="language-vbnet">Sub NormalizeVector(x As Double, y As Double)
    Dim magnitude As Double
    magnitude = Sqr(x * x + y * y)
    If magnitude &gt; 0 Then
        x = x / magnitude
        y = y / magnitude
    End If
End Sub</code></pre>
<h3 id="pattern-6-calculaterms">Pattern 6: <code>CalculateRMS</code></h3>
<p>Calculate root mean square</p>
<pre><code class="language-vbnet">Function CalculateRMS(values() As Double) As Double
    Dim i As Integer
    Dim sumSquares As Double
    Dim count As Integer
    count = UBound(values) - LBound(values) + 1
    sumSquares = 0
    For i = LBound(values) To UBound(values)
        sumSquares = sumSquares + values(i) ^ 2
    Next i
    CalculateRMS = Sqr(sumSquares / count)
End Function</code></pre>
<h3 id="pattern-7-solvequadratic">Pattern 7: <code>SolveQuadratic</code></h3>
<p>Solve quadratic equation ax² + bx + c = 0</p>
<pre><code class="language-vbnet">Function SolveQuadratic(a As Double, b As Double, c As Double, _
                        root1 As Double, root2 As Double) As Boolean
    Dim discriminant As Double
    discriminant = b * b - 4 * a * c
    If discriminant &lt; 0 Then
        SolveQuadratic = False
        Exit Function
    End If
    root1 = (-b + Sqr(discriminant)) / (2 * a)
    root2 = (-b - Sqr(discriminant)) / (2 * a)
    SolveQuadratic = True
End Function</code></pre>
<h3 id="pattern-8-calculatecircleradius">Pattern 8: <code>CalculateCircleRadius</code></h3>
<p>Calculate radius from area</p>
<pre><code class="language-vbnet">Function CalculateCircleRadius(area As Double) As Double
    Const PI As Double = 3.14159265358979
    CalculateCircleRadius = Sqr(area / PI)
End Function</code></pre>
<h3 id="pattern-9-calculatevelocity">Pattern 9: <code>CalculateVelocity</code></h3>
<p>Calculate velocity from kinetic energy</p>
<pre><code class="language-vbnet">Function CalculateVelocity(kineticEnergy As Double, mass As Double) As Double
    &#x27; KE = 1/2 * m * v^2
    &#x27; v = Sqr(2 * KE / m)
    If mass &gt; 0 Then
        CalculateVelocity = Sqr(2 * kineticEnergy / mass)
    Else
        CalculateVelocity = 0
    End If
End Function</code></pre>
<h3 id="pattern-10-isperfectsquare">Pattern 10: <code>IsPerfectSquare</code></h3>
<p>Check if number is a perfect square</p>
<pre><code class="language-vbnet">Function IsPerfectSquare(n As Long) As Boolean
    Dim sqrtValue As Double
    Dim intValue As Long
    If n &lt; 0 Then
        IsPerfectSquare = False
        Exit Function
    End If
    sqrtValue = Sqr(n)
    intValue = CLng(sqrtValue)
    IsPerfectSquare = (intValue * intValue = n)
End Function</code></pre>
<h2 id="advanced-usage">Advanced Usage</h2>
<h3 id="example-1-geometryhelper-class">Example 1: <code>GeometryHelper</code> Class</h3>
<p>Geometric calculations using Sqr</p>
<pre><code class="language-vbnet">&#x27; Class: GeometryHelper
Public Function DistanceBetweenPoints(x1 As Double, y1 As Double, _
                                      x2 As Double, y2 As Double) As Double
    DistanceBetweenPoints = Sqr((x2 - x1) ^ 2 + (y2 - y1) ^ 2)
End Function
Public Function PointToLineDistance(px As Double, py As Double, _
                                    x1 As Double, y1 As Double, _
                                    x2 As Double, y2 As Double) As Double
    &#x27; Distance from point to line segment
    Dim A As Double, B As Double, C As Double
    A = px - x1
    B = py - y1
    C = x2 - x1
    Dim D As Double
    D = y2 - y1
    Dim dot As Double
    dot = A * C + B * D
    Dim lenSq As Double
    lenSq = C * C + D * D
    Dim param As Double
    param = -1
    If lenSq &lt;&gt; 0 Then param = dot / lenSq
    Dim xx As Double, yy As Double
    If param &lt; 0 Then
        xx = x1
        yy = y1
    ElseIf param &gt; 1 Then
        xx = x2
        yy = y2
    Else
        xx = x1 + param * C
        yy = y1 + param * D
    End If
    Dim dx As Double, dy As Double
    dx = px - xx
    dy = py - yy
    PointToLineDistance = Sqr(dx * dx + dy * dy)
End Function
Public Function CircleArea(radius As Double) As Double
    Const PI As Double = 3.14159265358979
    CircleArea = PI * radius * radius
End Function
Public Function CircleRadiusFromArea(area As Double) As Double
    Const PI As Double = 3.14159265358979
    CircleRadiusFromArea = Sqr(area / PI)
End Function
Public Function SphereVolume(radius As Double) As Double
    Const PI As Double = 3.14159265358979
    SphereVolume = (4# / 3#) * PI * radius ^ 3
End Function
Public Function SphereRadiusFromVolume(volume As Double) As Double
    Const PI As Double = 3.14159265358979
    SphereRadiusFromVolume = ((3 * volume) / (4 * PI)) ^ (1# / 3#)
End Function</code></pre>
<h3 id="example-2-statisticscalculator-class">Example 2: <code>StatisticsCalculator</code> Class</h3>
<p>Statistical calculations with Sqr</p>
<pre><code class="language-vbnet">&#x27; Class: StatisticsCalculator
Private m_values() As Double
Private m_count As Integer
Public Sub AddValue(value As Double)
    If m_count &gt; UBound(m_values) Then
        ReDim Preserve m_values(0 To m_count * 2)
    End If
    m_values(m_count) = value
    m_count = m_count + 1
End Sub
Public Sub Clear()
    m_count = 0
    ReDim m_values(0 To 9)
End Sub
Private Sub Class_Initialize()
    Clear
End Sub
Public Function GetMean() As Double
    Dim sum As Double
    Dim i As Integer
    If m_count = 0 Then
        GetMean = 0
        Exit Function
    End If
    sum = 0
    For i = 0 To m_count - 1
        sum = sum + m_values(i)
    Next i
    GetMean = sum / m_count
End Function
Public Function GetStandardDeviation() As Double
    Dim mean As Double
    Dim sumSquaredDiff As Double
    Dim i As Integer
    If m_count = 0 Then
        GetStandardDeviation = 0
        Exit Function
    End If
    mean = GetMean()
    sumSquaredDiff = 0
    For i = 0 To m_count - 1
        sumSquaredDiff = sumSquaredDiff + (m_values(i) - mean) ^ 2
    Next i
    GetStandardDeviation = Sqr(sumSquaredDiff / m_count)
End Function
Public Function GetVariance() As Double
    Dim sd As Double
    sd = GetStandardDeviation()
    GetVariance = sd * sd
End Function
Public Function GetRMS() As Double
    Dim sumSquares As Double
    Dim i As Integer
    If m_count = 0 Then
        GetRMS = 0
        Exit Function
    End If
    sumSquares = 0
    For i = 0 To m_count - 1
        sumSquares = sumSquares + m_values(i) ^ 2
    Next i
    GetRMS = Sqr(sumSquares / m_count)
End Function
Public Property Get Count() As Integer
    Count = m_count
End Property</code></pre>
<h3 id="example-3-physicsengine-module">Example 3: <code>PhysicsEngine</code> Module</h3>
<p>Physics calculations using Sqr</p>
<pre><code class="language-vbnet">&#x27; Module: PhysicsEngine
Public Function CalculateVelocityFromEnergy(kineticEnergy As Double, _
                                            mass As Double) As Double
    &#x27; v = Sqr(2 * KE / m)
    If mass &gt; 0 Then
        CalculateVelocityFromEnergy = Sqr(2 * kineticEnergy / mass)
    Else
        CalculateVelocityFromEnergy = 0
    End If
End Function
Public Function CalculateEscapeVelocity(mass As Double, radius As Double) As Double
    &#x27; v_escape = Sqr(2 * G * M / R)
    Const G As Double = 6.674E-11  &#x27; Gravitational constant
    CalculateEscapeVelocity = Sqr(2 * G * mass / radius)
End Function
Public Function CalculatePeriod(length As Double) As Double
    &#x27; Period of simple pendulum: T = 2π * Sqr(L/g)
    Const PI As Double = 3.14159265358979
    Const g As Double = 9.81  &#x27; Gravity
    CalculatePeriod = 2 * PI * Sqr(length / g)
End Function
Public Function CalculateFallTime(height As Double) As Double
    &#x27; Time to fall from height: t = Sqr(2h/g)
    Const g As Double = 9.81  &#x27; Gravity
    CalculateFallTime = Sqr(2 * height / g)
End Function
Public Function CalculateImpactVelocity(height As Double) As Double
    &#x27; v = Sqr(2gh)
    Const g As Double = 9.81  &#x27; Gravity
    CalculateImpactVelocity = Sqr(2 * g * height)
End Function
Public Function CalculateOrbitalVelocity(mass As Double, radius As Double) As Double
    &#x27; v = Sqr(G * M / R)
    Const G As Double = 6.674E-11  &#x27; Gravitational constant
    CalculateOrbitalVelocity = Sqr(G * mass / radius)
End Function</code></pre>
<h3 id="example-4-vectormath-module">Example 4: <code>VectorMath</code> Module</h3>
<p>Vector operations using Sqr</p>
<pre><code class="language-vbnet">&#x27; Module: VectorMath
Public Function VectorMagnitude2D(x As Double, y As Double) As Double
    VectorMagnitude2D = Sqr(x * x + y * y)
End Function
Public Function VectorMagnitude3D(x As Double, y As Double, z As Double) As Double
    VectorMagnitude3D = Sqr(x * x + y * y + z * z)
End Function
Public Sub NormalizeVector2D(x As Double, y As Double)
    Dim magnitude As Double
    magnitude = VectorMagnitude2D(x, y)
    If magnitude &gt; 0 Then
        x = x / magnitude
        y = y / magnitude
    End If
End Sub
Public Sub NormalizeVector3D(x As Double, y As Double, z As Double)
    Dim magnitude As Double
    magnitude = VectorMagnitude3D(x, y, z)
    If magnitude &gt; 0 Then
        x = x / magnitude
        y = y / magnitude
        z = z / magnitude
    End If
End Sub
Public Function DotProduct2D(x1 As Double, y1 As Double, _
                             x2 As Double, y2 As Double) As Double
    DotProduct2D = x1 * x2 + y1 * y2
End Function
Public Function VectorDistance2D(x1 As Double, y1 As Double, _
                                 x2 As Double, y2 As Double) As Double
    VectorDistance2D = Sqr((x2 - x1) ^ 2 + (y2 - y1) ^ 2)
End Function
Public Function VectorAngleBetween(x1 As Double, y1 As Double, _
                                   x2 As Double, y2 As Double) As Double
    &#x27; Returns angle in radians
    Dim dot As Double
    Dim mag1 As Double, mag2 As Double
    dot = DotProduct2D(x1, y1, x2, y2)
    mag1 = VectorMagnitude2D(x1, y1)
    mag2 = VectorMagnitude2D(x2, y2)
    If mag1 &gt; 0 And mag2 &gt; 0 Then
        VectorAngleBetween = Atn(Sqr(1 - (dot / (mag1 * mag2)) ^ 2) / (dot / (mag1 * mag2)))
    Else
        VectorAngleBetween = 0
    End If
End Function</code></pre>
<h2 id="error-handling">Error Handling</h2>
<p>The Sqr function can generate the following errors:
- <strong>Error 5</strong> (Invalid procedure call or argument): If number is negative
- <strong>Error 13</strong> (Type mismatch): If argument is not numeric
Always validate inputs:</p>
<pre><code class="language-vbnet">On Error Resume Next
If value &gt;= 0 Then
    result = Sqr(value)
    If Err.Number &lt;&gt; 0 Then
        MsgBox &quot;Error calculating square root: &quot; &amp; Err.Description
    End If
Else
    MsgBox &quot;Cannot calculate square root of negative number&quot;
End If</code></pre>
<h2 id="performance-considerations">Performance Considerations</h2>
<ul>
<li>Sqr is a relatively fast operation</li>
<li>Uses hardware floating-point unit when available</li>
<li>For repeated calculations, consider caching results</li>
<li>Sqr(x^2) is slower than Abs(x) for getting absolute value</li>
<li>For integer square roots, consider using Int(Sqr(x))</li>
</ul>
<h2 id="best-practices">Best Practices</h2>
<ol>
<li><strong>Validate Input</strong>: Always ensure argument is non-negative</li>
<li><strong>Use for Distances</strong>: Ideal for Euclidean distance calculations</li>
<li><strong>Combine with ^2</strong>: Use for Pythagorean theorem applications</li>
<li><strong>Handle Zero</strong>: Remember Sqr(0) = 0 is valid</li>
<li><strong>Precision Aware</strong>: Understand floating-point precision limits</li>
<li><strong>Error Handling</strong>: Trap errors for negative inputs</li>
<li><strong>Performance</strong>: Cache results when used repeatedly</li>
<li><strong>Consider Abs</strong>: For Sqr(x^2), use Abs(x) instead</li>
<li><strong>Document Units</strong>: Comment on units in physics calculations</li>
<li><strong>Test Edge Cases</strong>: Test with 0, very small, and very large values</li>
</ol>
<h2 id="comparison-with-related-functions">Comparison with Related Functions</h2>
<table>
<thead>
<tr>
<th>Operation</th>
<th>VB6 Function</th>
<th>Example</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>Square root</td>
<td>Sqr(x)</td>
<td>Sqr(25)</td>
<td>5</td>
</tr>
<tr>
<td>Cube root</td>
<td>x^(1/3)</td>
<td>27^(1/3)</td>
<td>3</td>
</tr>
<tr>
<td>Nth root</td>
<td>x^(1/n)</td>
<td>16^(1/4)</td>
<td>2</td>
</tr>
<tr>
<td>Power</td>
<td>x^y</td>
<td>2^3</td>
<td>8</td>
</tr>
<tr>
<td>Absolute value</td>
<td>Abs(x)</td>
<td>Abs(-5)</td>
<td>5</td>
</tr>
</tbody>
</table>
<h2 id="platform-considerations">Platform Considerations</h2>
<ul>
<li>Available in VB6, VBA (all versions)</li>
<li>Part of core mathematical functions</li>
<li>Uses IEEE 754 floating-point arithmetic</li>
<li>Consistent behavior across platforms</li>
<li>Hardware-accelerated on modern processors</li>
</ul>
<h2 id="limitations">Limitations</h2>
<ul>
<li>Cannot calculate square root of negative numbers (use complex number libraries)</li>
<li>Subject to floating-point precision limits (~15-17 significant digits)</li>
<li>Sqr(x)^2 may not exactly equal x due to rounding</li>
<li>Very large numbers may overflow Double range</li>
<li>Very small numbers may underflow to zero</li>
</ul>
<h2 id="related-functions">Related Functions</h2>
<ul>
<li><code>Abs</code>: Returns absolute value of a number</li>
<li><code>Exp</code>: Returns e raised to a power</li>
<li><code>Log</code>: Returns natural logarithm</li>
<li><code>^</code> operator: Raises number to a power (x^0.5 = Sqr(x))</li>
</ul>
        </article>
        
        <div style="margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color);">
            <p>
                <a href="index.html">← Back to Math</a> |
                <a href="../index.html">View all functions</a>
            </p>
        </div>

    </main>

    <footer>
        <div class="container">
            <p>&copy; 2024-2026 VB6Parse Contributors. Licensed under the MIT License.</p>
        </div>
    </footer>
</body>
</html>