PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Floats

Floats

Floats are a language feature.

A data type that represents a non-integer number.

Languages with Floats include Java, JavaScript, Python, Go, Perl, Swift, MySQL, JSON, Haskell, Clojure, Erlang, Mathematica, Prolog, Julia, Elixir, Ada, OCaml, F#, CoffeeScript, D, Chapel, Elm, Verilog, awk, Eiffel, Reason, PostScript, GNU Octave, GraphQL, VHDL, Idris, Zig, Applescript, WebAssembly, ClojureScript, Io, Hy, J, VBScript, Boo, IDL, ActionScript, TOML, Protocol Buffers, AMPL, XQuery, AutoIt, Icon, SPARQL, QBasic, SuperCollider, Agda, Scilab, Opa, Ceylon, Ioke, Maxima, F*, Koka, Coq, Zephir, K, Turtle, AutoHotkey, Modelica, SystemVerilog, Monkey, LiveScript, Pig Latin, Cython, Puppet, Transact-SQL, Unicon, Pony, AspectJ, Gosu, Thrift, Fennel, QML, LilyPond, EDN, Cryptol, Nit, Futhark, Felix, ooc, Fancy, GLSL, PL/pgSQL, Xtend, BlitzBasic, Stan, Whiley, MiniD, Golo, OpenEdge ABL, BlitzMax, HLSL, SourcePawn, chaiscript, GDScript, Shen, Linden Scripting Language, monte, Ion, POV-Ray SDL, parasail, Earl Grey, JSLT, Pawn, PromQL, FloScript, Flatline, Urbiscript, nimrod, CBOR data definition language, Easytrieve, AmbientTalk, Kal, RAISE Specification Language, juttle, SARL, SquidConf, Croc

Example from Java, AspectJ:

// ([0-9][0-9_]*\.([0-9][0-9_]*)?|\.[0-9][0-9_]*)([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)[pP][+\-]?[0-9][0-9_]*[fFdD]?

Example from JavaScript:

// (\.[0-9]+|[0-9]+\.[0-9]*|[0-9]+)([eE][-+]?[0-9]+)?

Example from Python:

# (\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)([eE][+-]?\d(?:_?\d)*)?

Example from Go:

// \d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)

Example from Perl:

# (?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?

Example from Swift:

// [0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*|[eE][+\-]?[0-9_]+)

Example from MySQL, Transact-SQL:

-- [0-9]+\.[0-9]*(e[+-]?[0-9]+)?

Example from JSON:

2.3

Example from Haskell:

-- 0[xX]_*[\da-fA-F](_*[\da-fA-F])*_*[pP][+-]?\d(_*\d)*

Example from Clojure, Hy, Fennel:

; -?\d+\.\d+

Example from Erlang:

% [+-]?\d+.\d+

Example from Prolog:

% (\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?

Example from Julia:

# (\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?

Example from Elixir:

# \d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?

Example from Ada:

-- [0-9_]+\.[0-9_]*

Example from F#:

// -?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)[fFmM]?

Example from CoffeeScript, awk:

# [0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?

Example from D:

// 0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\-]?[0-9_]+[fFL]?[i]?

Example from Chapel:

// (\d*\.\d+)([eE][+-]?[0-9]+)?i?

Example from Elm:

-- _?\d+\.(?=\d+)

Example from Verilog, SystemVerilog:

// (\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?

Example from Eiffel:

-- ([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)

Example from Reason:

// -?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)

Example from PostScript:

% (\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?(?=[()<>\[\]{}/%\s])

Example from GNU Octave:

% (\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?

Example from VHDL:

-- (\d+\.\d*|\.\d+|\d+)E[+-]?\d+

Example from Idris, Agda:

-- \d+[eE][+-]?\d+

Example from Applescript:

-- [-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?

Example from Io:

// (\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?

Example from J:

NB. _?\d+\.(?=\d+)

Example from VBScript:

' [0-9]+\.[0-9]*(e[+-]?[0-9]+)?

Example from Boo:

# (\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?

Example from TOML, GDScript:

# (\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?

Example from Protocol Buffers:

// (\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*

Example from AMPL:

# (\d+\.(?!\.)\d*|\.(?!.)\d+)([eE][+-]?\d+)?

Example from AutoIt, AutoHotkey:

; (\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?

Example from Icon, Unicon:

# [+-]?[0-9]*\.([0-9]*)([Ee][+-]?[0-9]*)?

Example from SPARQL:

# [+\-]?(\d+\.\d*[eE][+-]?\d+|\.?\d+[eE][+-]?\d+)

Example from SuperCollider, Zephir, QML:

// [0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?

Example from Scilab:

// (\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?

Example from Ceylon:

// \d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?

Example from Koka:

// [0-9]+\.[0-9]+([eE][\-+]?[0-9]+)?

Example from K:

/ ([0-9]*[.]?[0-9]+|[0-9]+[.]?[0-9]*)[eE][+-]?[0-9]+[ef]?

Example from Modelica:

// \d+(\.?\d*[eE][-+]?\d+|\.\d*)

Example from Monkey:

' [0-9]+\.[0-9]*(?!\.)

Example from LiveScript:

# [0-9]+\.[0-9]+([eE][0-9]+)?[fd]?(?:[a-zA-Z_]+)?

Example from Pig Latin:

-- [0-9]*\.[0-9]+(e[0-9]+)?[fd]?

Example from Felix:

// 0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\-]?[0-9_]+[lLfFdD]?

Example from Whiley:

// [0-9]+\.[0-9]+

Example from MiniD:

// ([0-9][0-9_]*)(?=[.eE])(\.[0-9][0-9_]*)?([eE][+\-]?[0-9_]+)?

Example from Golo:

# -?[\d_]*\.[\d_]*([eE][+-]?\d[\d_]*)?F?

Example from Linden Scripting Language:

// (\d+\.\d*|\.\d+|\d+)[eE][+-]?\d*

Example from Ion:

// http://amzn.github.io/ion-docs/docs/spec.html -0.12e4 // Type is float

Example from POV-Ray SDL:

// [0-9]*\.[0-9]+

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements · Email · GitHub