What are the numbers before and after the decimal point referred to in mathematics?
There are two terminologies that I'm familiar with. Sometimes, the part to the right of the decimal (cents) is called the mantissa, and the part to the left (dollars, in your metaphor), is called the characteristic.
But I also like the generic terms integer-part and fractional-part. It's what I and those with whom I do research call them (who uses the word mantissa routinely? not me, but perhaps someone). Yes, I know the fractional part doesn't actually have to be a fraction, but that's just something I toss into my big bag of math vagaries.
Since the term "Mantissa" can refer to the "Fractional part" of the number for logs, and it can also refer to the "Integer part" and "Fractional part" of the number (combined, without the "Exponent part") for numbers in scientific notation and floating point... it is an ambiguous term and should be avoided.
"Significand" is also not appropriate since it also refers to the "Integer part" and "Fractional part" of the number (combined, without the "Exponent part"), for numbers in scientific notation and floating point.
I prefer to use the terms "Integer digits" and "Fractional digits" (or "Integer part" and "Fractional part").
As far as the method to capture the "Integer digits" and "Fractional digits" for a negative number. Given a negative number like n = -2.3:
(Perhaps this is not important to you because your numbers (data) may all be positive numbers).
Method 1:
While it may be correct from a purely technical or academic standpoint to split this up as:
"Integer digits" = (-)3
"Fractional digits" = (+).7
It may not make sense for you depending on how you will use it.
If you will be treating these parts of the number, also as numbers (rather than "Strings"), and you will at some time combine these two number parts back into the original number, this method has the advantage that you can simply add the two parts of the number together to get the original number back: (-)3 + (+).7 = (-)2.3.
Method 2:
You could get the same effect by storing the sign of the number with each part of the number:
"Integer digits" = (-)2
"Fractional digits" = (-).3
This will also allow you to simply add the two parts of the number together to get the original number back: (-)2 + (-).3 = (-)2.3.
But, perhaps your purpose of breaking the number up is to facilitate displaying the number in a particular way. Neither of these methods would be very useful for this purpose, particularly if you were storing the number parts as strings. Storing the number parts using the first method would take some odd Mathematical gymnastics to get a printable version of the number back.
My recommendation is Method 3:
Split the number up like this:
- Given a number "n" like n = -2.3 or n = 2.3
- Store the "Sign" of the number:
s = Sgn(n)
Or as boolean:s = (n >= 0)
- Remove the "Sign" of the number
n = Abs(n)
- Save "Integer digits" portion:
i = Fix(n)
- Save "Decimal digits" portion:
d = n - i
Or as "String":d = Mid(CStr(n - i), 3)
Or as "Integer":d = ((n - i) * 10000)
"scale of a number":
Scale is the number of digits to the right of the decimal point in a number. For example, the number 123.45 has a precision of 5 and a scale of 2.
bc
- The arbitrary precision calculator - defines it for us in their documentation. For example, type man bc
on your linux terminal
NUMBERS
The most basic element in bc is the number. Numbers are arbitrary pre‐
cision numbers. This precision is both in the integer part and the
fractional part. All numbers are represented internally in decimal and
all computation is done in decimal. (This version truncates results
from divide and multiply operations.) There are two attributes of num‐
bers, the length and the scale. The length is the total number of dec‐
imal digits used by bc to represent a number and the scale is the total
number of decimal digits after the decimal point. For example:
.000001 has a length of 6 and scale of 6.
1935.000 has a length of 7 and a scale of 3.
Please see "scale" referenced in another similar question in the StackExchange network, and some oracle database documentation for the NUMBER datatype that is quoted below:
Optionally, you can also specify a precision (total number of digits) and scale (number of digits to the right of the decimal point):
column_name NUMBER (precision, scale)