Did the BCPL programming language support floating point? If not, then how did programmers use it to add two floating point numbers?
BCPL did include floating point, but only as an extension and some smaller systems chose not to implement it. The Arnor Z80 BCPL compiler I learned on did not support FP.
The Tenex BCPL manual (1974) describes its floating point operations and representations as being relatively standard: one could add two floats with the
+ operator, as expected.
1.10.1979 67 BCPL Standard A13 Floating point ______________ There are two possible schemes for a floating point package in BCPL: on implementations where the cell size is big enough to hold the machine representation of a floating point number the Floating Point Language Packet may be implemented and where this is not possible the Floating Point Procedure Packet may be implemented. In either case the Floating Point I/O Procedures should be implemented.
BCPL's Floating Point Language Packet - for machines large enough to hold FP values in a memory cell - prefixed the corresponding integer operation with the character
#, such as
#-, etc. So two numbers could be added using
The Floating Point Procedure Packet - for machines where FP values were held as a vector of cells - used special functions, including (again from the Tripos manual):
Arithmetic Functions ____________________ FPLUS(A,B,C) C:=A#+B resultis C FMINUS(A,B,C) C:=A#-B resultis C FNEG(A,B) B:=#-A resultis B FMULT(A,B,C) C:=A#*B resultis C FDIV(A,B,C) C:=A#/B resultis C FABS(A,B) B:=#ABS A resultis B
Floating point support was clearly implementation-specific, and would need to be reviewed on attempting to port software from one site to another.
No, BCPL did not support floating point, unless the system's native word was interpreted as a floating point value. It also didn't support any other types.
From the BCPL manual, section 1.0, point 2:
All data items have Rvalues which are bit patterns of the same length and the type of an Rvalue depends only on the context of its use and not on the declaration of the data item. This simplifies the compiler and improves the object code efficiency but as a result there is no type checking.
An "Rvalue" is, basically, a value that can be used on the right-hand side of an assignment. It's the opposite of an "Lvalue", which (again basically) is something that can be assigned to.
Considering its intended use:
BCPL is a simple recursive programming language designed for compiler writing and system programming [...]
it seems doubtful that floating-point processing would be an important enough feature to include, especially in a world where many systems might not be floating-point capable at all. The manual also doesn't mention "float", and "decimal" only appears once in the meaning of "base 10".
No, but Martin Richards has recently added floating point operators, with a funny kind of type inference to distinguish between integer and floating point arithmetic. From https://www.cl.cam.ac.uk/~mr10/bcplman.pdf, page 32:
BCPL was originally designed for the implemention of compilers and other system software such as text editors, pagination programs and operating systems. These applications typically did not require floating point and so the language did not include any floating point features. Indeed, many early machines on which BCPL ran had word lengths of 16 or 24 bits which were of insufficient length for useful floating point numbers. Even on 32-bit machines the precision of floating point numbers is limited to about 6 decimal digits which is insuffient for serious scientific calculations. For 50 years I resisted putting floating point into BCPL but have recently given in.