13

The paper What Every Computer Scientist Should Know About Floating-Point Arithmetic uses the Cray's systems as an example of computers without a guard bit:

Although most modern computers have a guard digit, there are a few (such as Cray® systems) that do not.

Mathematics Written in Sand (William Kahan, 1983) suggests the same (for subtraction, specifically). But the hardware reference manual for the CRAY-1 and CRAY-2 describes how a guard bit is used for the add unit (that implements single-precision arithmetic only). So, I can think of two explanations:

  1. The lack of guard bit affects other Cray systems.
  2. The lack of guard bit affects the software implementation of double-precision arithmetic.

Is one (or both) of these right?


Edit: The Cray-1 Hardware Reference Manual does not explicitly state that a guard bit is used. Instead, it states that (page 3-24):

Floating point addition or subtraction is performed in a 49-bit register.

enter image description here

That is, addition is carried out with one extra bit. As Figure 3-4 shows the 49th bit as the leading 1 of the largest operand, it may suggest that the extra bit is used for an implicit, IEEE-754-like, leading bit. But floating-point numbers only had a 48-bit coefficient (page 3-21)

Floating point numbers are represented in a standard format throughout the CPU. This format is a packed representation of a binary coefficient and an exponent or power of two. The coefficient is a 48-bit signed fraction.

with no implicit bit (page 3-22)

A non-zero floating point number in packed format is normalized if the most significant bit of the coefficient is non-zero.

Unfortunately, I did not find an example in this manual. However, while it's a different model, there is one in the CRAY-2 Computer Systems Functional Description Manual. The octal representation of +1 is: 0 (signal) 40001 (exponent with bias 40000) 4000000000000000 (48-bit coefficient).

An Analysis of the Cray-1 Computer (Richard Sites, 1978) also states that a guard bit was used:

Addition is done with one guard bit and the result is truncated after normalization, with no rounding.

New contributor
Morel is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
6
  • 3
    What does a "guard bit" do? Is it called something else in some other contexts? Commented Nov 19 at 17:39
  • 1
    Could you edit your question and quote where the hardware reference manual says that a guard bit is used? E.g. for the Cray-1, it says on page 3-23 that a 49-bit register is used, but the figure suggests that the 49th bit is the leading 1, so I am not entirely sure they use a guard bit. But I may be interpreting it wrong, or there may be a different passage. Commented Nov 19 at 18:22
  • 5
    @Justme: A "guard bit" is a means by which a floating-point subtraction unit can correctly handle cases where the result will have a smaller exponent than the larger input value. Using 4-bit math, consider the scenario where 1.101B+3 is subtracted from 1.000B+4 (in decimal, subtracting 13 from 16). If 1.101B were shifted to line up the exponents without keeping an extra bit, that would round the value to 1.100B+4 (12), yielding a result of 1.000B+2 (4). Doing the subtration as 1.0000B+4 - 0.1101B+4 will yield the correct value of 1.100B+1 (3). Commented Nov 19 at 18:49
  • 3
    In cases where the exponents of the two values differ by one, a single guard bit will suffice because the subtrahend will only be shifted by one place, even though the result may end up having a much smaller exponent. In cases where the exponents differ by more than one, a single guard bit will suffice because the magnitude of the result can be at most one smaller than the exponent of the larger number. A guard bit isn't the only way of designing circuitry to properly handle these corner cases, but it's generally the simplest. Commented Nov 19 at 18:52
  • 3
    There appears to be some consensus that the answer is 'no' - see cray-history.net/2021/08/26/cray-floating-point-numbers and cray-history.net/wp-content/uploads/2021/08/CrayUG-IEEE.pdf. Me, I know nuffink about it other than wot I read. Commented 2 days ago

1 Answer 1

7

The article How Cray's Arithmetic Hurts Scientific Computation from 1990 by William Kahan (the "father of floating point") states at the beginning:

CRAY's floating point hardware runs fast but breaks mathematical rules honored nowadays by practically all computer arithmetic of commercial significance in scientific and engineering computation. [...] For instance, CRAYs software DOUBLE PRECISION (REAL*16) runs about three times slower than it could if CRAY's floating point add/subtract possessed the guard digit enjoyed by other computer arithmetics. Retrofitting the guard bit, as proposed herein, will not affect existing software on CRAYs adversely nor will it slow CRAY's cycle time.

and on page 10:

The two operations that cause trouble are the substractions [...] Were they replaced by SINGL(DBLE(A) - B) [...] in FORTRAN on CRAYs, and only on CRAYs, the program would get provably correct results on CRAYs too.

All of this is about the Cray-2. The article states that the Cray-XP and Cray-YP work slightly differently, but with the same problem, and then goes on to explain a "reverse engineered" substraction process that

[...] does not match exactly what CRAY's manuals say, yet I think it matches what they intend to say.

So there is empirical evidence that the Cray-2 does not use a guard bit, and there is wider agreement that one has to be very careful when porting programs to the Cray.

There is also empirical evidence (page 11) that the Cray-1 failed in different ways.

I think from this we can conclude that the Cray-1, the Cray-2, and the Cray-XP, Cray-YP indeed did not use a guard bit, and that the "49-bit register" mentioned in the manuals is used in some different way, whatever it is.

Short of having a working Cray to either verify the empirical evidence, or to reverse engineer the floating addition/subtraction functional unit, I think that's probably the best we can do.

The article ends with

An abbreviated version of the foregoing material was presented to the CRAY Users' Group [...] Later [...] the Group framed a petition to CRAY asking that [...] CRAY retrofit the guard digits missing from add/subtract and multiply in its present hardware. [...] However, CRAY declined to retrofit anything.


You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.