is the head used for real (floating‐point) numbers.
- _Real can be used to stand for a real number in a pattern.
- You can enter a floating‐point number of any length.
- You can enter a number in scientific notation by using the form mantissa*^exponent.
- You can enter a floating‐point number in base b using b^^digits. The base can be up to 36. The letters a–z or A–Z are used in sequence to stand for digits 10 through 35.
- Real is also used to indicate an approximate real number in Read.
Examplesopen allclose all
Real numbers entered with just a few digits are generally represented as machine reals:
Enter a real number with many significant digits:
Arbitrary-precision reals are used when too many digits are given for a machine number:
Its Accuracy is based on the number of digits to the right of the decimal point:
Enter a real number with a specified Precision:
Enter a real number with a specified Accuracy:
Enter a real number with an exponent:
Enter a real number with an exponent and specified precision:
Enter a real number in binary:
Enter a real number in binary with precision specified in terms of bits:
Enter a real number in hexadecimal:
Enter a real number in base 35:
Format a real number using base 2:
_Real can be used to represent a real number in a pattern:
Determine if a matrix consists entirely of approximate reals:
A rule that rounds all reals to have two digits after the decimal point:
Divide a restaurant bill to the nearest penny:
Define a function that only works for reals:
Define a function that has a special case for reals:
For integers and rationals use the corresponding approximate real:
Properties & Relations (5)
Possible Issues (1)
Real is only the head for approximate real numbers:
You can use the following function to test for numbers on the real axis:
Wolfram Research (1988), Real, Wolfram Language function, https://reference.wolfram.com/language/ref/Real.html (updated 1996).
Wolfram Language. 1988. "Real." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/Real.html.
Wolfram Language. (1988). Real. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Real.html