0
$\begingroup$

What is an exhaustive as possible list of examples of floating-point literals as they are written in source code?

That is, the float is not parsed from a text file with arbitrary floats.

The float literal must is written in correct syntax for a programming language such that one or both of the following:

  • the computer language is mainstream today.
  • the computer language was main-stream in the past.

double-precision is allowed, single-precision is allowed, any precision is allowed, base 16, base 8, etc...

If you understand the question, then you can stop reading the question now.


The string representation you provide for floating point must be used by the parser, or interpreter, or compiler for source code in one or more language which is well-used in the present or was well-used used in the past such as java-script, HTML, python, C++, Fortran, Intel x86 assembly, Java, etc...

If the terms "mainstream" and "well-used" are too subjective for your taste, then the following list might help:

Intel x86 Assembly language
Fortran
C
Java
ABAP
ABL
Ada
Assembly
Awk
Bash (Bourne Again Shell) script
C
C#
C++
CFML
COBOL
D
Dart
Delphi/Object
F#
Fortran
FoxPro
Go
Groovy
Haskell
Java
JavaScript
Julia Kotlin
Lisp
Logo
Lua
MATLAB
Objective-C
OpenEdge
Perl
PHP
PL/SQL
PowerShell
Prolog
Python
R Ruby Rust
SAS Scala Scheme Scratch SQL
Swift
Transact-SQL
TypeScript
Visual
Visual Basic
Zig

This is a publicly editable wiki, so feel free to add more to it.

$\endgroup$
1
  • 6
    $\begingroup$ I'm a bit confused by the purpose of this question. Why make such a list? Can you edit it to add context as to why it is a question about teaching? $\endgroup$
    – Ben I.
    Apr 26, 2023 at 10:43

1 Answer 1

1
$\begingroup$

3.14e2
3.14e-67f
.14E4f
0x10.1p0
0x1p5
0x1e5
3.14'15'92
3.14e-4932l
3.14e38f
3.14e38
3.14e38l
3.14_15F
10_000_000.0
+1.23E+1
3.1415926D0
5.d0
1.
0xfadebeep-8

$\endgroup$
1
  • 1
    $\begingroup$ 0xfadebeep-8 is not a decimal. $\endgroup$ May 5, 2023 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.