<number>
<number>
is a Math
component that calculates a numerical (floating point) value from its contents
and displays the result as text.
The default precision for display is either: (1) rounded to three significant digits or (2) rounded two decimal places, whichever has more digits.
Attributes and Properties
Attribute | Type | Values |
---|---|---|
anchor = "…" | point | |
convertBoolean = "…" | "true" "false" | |
displayDecimals = "…" | integer | |
displayDigits = "…" | integer | |
displaySmallAsZero = "…" | number | |
draggable = "…" | boolean | "true" "false" |
layer = "…" | number | |
padZeros = "…" | boolean | "true" "false" |
positionFromAnchor = "…" | text | "upperright" "upperleft" "lowerright" "lowerleft" "top" "bottom" "left" "right" "center" |
renderAsMath = "…" | boolean | "true" "false" |
valueOnNaN = "…" |
Property | Type |
---|---|
$n.anchor | point |
$n.backgroundColor | text |
$n.disabled | boolean |
$n.displayDecimals | integer |
$n.displayDigits | integer |
$n.displaySmallAsZero | number |
$n.draggable | boolean |
$n.fixed | boolean |
$n.fixLocation | boolean |
$n.hidden | boolean |
$n.latex | latex |
$n.layer | number |
$n.math | math |
$n.padZeros | boolean |
$n.positionFromAnchor | text |
$n.renderAsMath | boolean |
$n.text | text |
$n.textColor | text |
$n.textStyleDescription | text |
$n.value | number |
Example: Display numerical approximation
The default precision for display is either (1)rounded to three significant digits or (2) rounded two decimal places, whichever has more digits.
Attribute Example: renderAsMath
The renderAsMath
attribute adjusts the default font for a <number>
in order
for it to appear the same as that of a <math>
.
The same effect can be achieved by placing the <number>
inside a <m>
component,
as shown in the last paragraph of the example above.
Attribute Example: convertBoolean
The convertBoolean
attribute renders or stores a boolean that evaluates to true
as 1 and to false
as 0.
Attribute Example: valueOnNaN
The valueOnNaN
attribute allows for temporary values (which can be used in boolean conditions) to
be stored by Doenet until a new number is assigned
Attribute Example: anchor
The anchor
attribute sets the location of a <number>
placed within a <graph>
.
Attribute Example: draggable
The draggable
attribute determines whether the <point>
can be
dragged around the <graph>
. All graphical objects are draggable by default.
Attribute Example: displayDigits/displayDecimals
By default, numbers will be displayed as rounded to three digits or to two
decimal places, whichever includes more digits. The displayDigits
attribute will
change the number of digits, and the displayDecimals
attribute will
change the number of decimal places.
Note: these display rounding settings do not affect the actual value of the
numbers in the expression. All available digits will be used if the expression
is used in another calculation unless one uses the <round>
component to explicitly round numbers.
Attribute Example: displaySmallAsZero
The default value of the displaySmallAsZero
attribute is , which means that
numerical values smaller than that value will appear as zero. This behavior can be
altered by changing the value of displaySmallAsZero
to a different number, or even setting it to “false”.
Attribute Example: padZeros
If the padZeros
is set, then numbers will be displayed padded with zeros so
that all the digits from the combination of displayDigits
and displayDecimals
will be shown.
Property Example: value
The value
property renders the value stored in the <number>
.
Property Example: text
The text
property renders the text value stored in the <number>
.
Property Example: latex
The latex
property renders the latex code for rendering the <number>
.