```
' Returns the mantissa of a decimal number as
' a string to preserve leading zeroes.
'
' Examples:
' Mantissa(1234.56789) -> "56789"
' Mantissa(-1234.56789) -> "56789"
' Mantissa(1234.056789) -> "056789"
' Mantissa(-1234.056789) -> "056789"
' Mantissa(123456789) -> ""
'
' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH.
'
Public Function Mantissa( _
ByVal Number As Double) _
As String
Dim Result As String
Dim Fraction As Variant
Fraction = CDec(Number) - CDec(Fix(Number))
If Fraction <> 0 Then
Result = Mid(Str(Abs(Fraction)), 3)
End If
Mantissa = Result
End Function
```

/gustav
From gustav at cactus.dk Mon Oct 16 05:33:49 2017
From: gustav at cactus.dk (Gustav Brock)
Date: Mon, 16 Oct 2017 10:33:49 +0000
Subject: [dba-VS] [dba-VB] C#, mantissa, math fun
Message-ID: ```
' Returns the mantissa of a decimal number as
' a string to preserve leading zeroes.
'
' Maximum returned length of mantissa is:
' Single: 8
' Double: 16
' Currency: 4
' Decimal: 28
'
' Examples:
' Mantissa(1234.56789) -> "56789"
' Mantissa(-1234.56789) -> "56789"
' Mantissa(1234.056789) -> "056789"
' Mantissa(-1234.056789) -> "056789"
' Mantissa(123456789) -> ""
' Mantissa(CDec("-0.0123456789012345678901234567")) -> "0123456789012345678901234567"
' Mantissa(CDbl("-0.0123456789012345678901234567")) -> "0123456789012346"
'
' 2017-10-16. Gustav Brock, Cactus Data ApS, CPH.
'
Public Function Mantissa( _
ByVal Number As Variant) _
As String
Dim Result As String
Dim Fraction As Variant
If IsNumeric(Number) Then
' Convert to Decimal to prevent scientific notation of doubles and singles.
Fraction = CDec(Number) - Fix(CDec(Number))
If Fraction <> 0 Then
Result = Mid(Str(Abs(Fraction)), 3)
End If
End If
Mantissa = Result
End Function
```

/gustav
-----Oprindelig meddelelse-----
Fra: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] P? vegne af Gustav Brock
Sendt: 15. oktober 2017 17:54
Til: Development in Visual Studio ```
' Returns the mantissa of a decimal number as ' a string to preserve leading zeroes.
'
' Examples:
' Mantissa(1234.56789) -> "56789"
' Mantissa(-1234.56789) -> "56789"
' Mantissa(1234.056789) -> "056789"
' Mantissa(-1234.056789) -> "056789"
' Mantissa(123456789) -> ""
'
' 2017-10-15. Gustav Brock, Cactus Data ApS, CPH.
'
Public Function Mantissa( _
ByVal Number As Double) _
As String
Dim Result As String
Dim Fraction As Variant
Fraction = CDec(Number) - CDec(Fix(Number))
If Fraction <> 0 Then
Result = Mid(Str(Abs(Fraction)), 3)
End If
Mantissa = Result
End Function
```

/gustav
_______________________________________________
dba-VS mailing list
dba-VS at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vs
http://www.databaseadvisors.com
From accessd at shaw.ca Mon Oct 16 11:43:29 2017
From: accessd at shaw.ca (Jim Lawrence)
Date: Mon, 16 Oct 2017 10:43:29 -0600 (MDT)
Subject: [dba-VS] [dba-VB] C#, mantissa, math fun
In-Reply-To: