Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Floating-point arithmetic
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Literal syntax === Literals for floating-point numbers depend on languages. They typically use <code>e</code> or <code>E</code> to denote [[scientific notation]]. The [[C (programming language)|C programming language]] and the [[IEEE 754]] standard also define a [[IEEE 754#Hexadecimal literals|hexadecimal literal syntax]] with a base-2 exponent instead of 10.<!-- Also in [[Hexadecimal#Hexadecimal exponential notation]] --> In languages like [[C (programming language)|C]], when the decimal exponent is omitted, a decimal point is needed to differentiate them from integers. Other languages do not have an integer type (such as [[JavaScript]]), or allow overloading of numeric types (such as [[Haskell (programming language)|Haskell]]). In these cases, digit strings such as <code>123</code> may also be floating-point literals. Examples of floating-point literals are: * <code>99.9</code> * <code>-5000.12</code><!-- do not use ndash, as that isn't part of a literal(?)--> * <code>6.02e23</code> * <code>-3e-45</code> * <code>0x1.fffffep+127</code> in C and IEEE 754
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)