long float

L

Lew Pitcher

In K&R C ("The C Programming Language", Appendix A, section 8.2 "Type
Specifiers"), the authors enumerate the uses of the "long" type specifier
thusly:
The words long, short, and unsigned may be thought of as adjectives; the
following combinations are acceptable.
short int
long int
unsigned int
long float
The meaning of the last is the same as double.

Does "long float" still mean "double" in ISO Standard C (any vintage)?

FWIW, both GCC v4.2.4 and v4.7.1 complain with the same sort of error when
presented with a long float:
error: both 'long' and 'float' in declaration specifiers


~/Code/clc $ cat lf.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
long float should_be_double;

should_be_double = 1.0;

return EXIT_SUCCESS;
}

~/Code/clc $ gcc -o lf lf.c
lf.c: In function 'main':
lf.c:5:8: error: both 'long' and 'float' in declaration specifiers
 
J

James Kuyper

In K&R C ("The C Programming Language", Appendix A, section 8.2 "Type
Specifiers"), the authors enumerate the uses of the "long" type specifier
thusly:
The words long, short, and unsigned may be thought of as adjectives; the
following combinations are acceptable.
short int
long int
unsigned int
long float
The meaning of the last is the same as double.

Does "long float" still mean "double" in ISO Standard C (any vintage)?

No, as far as C99 and C2011 are concerned. I don't have a copy of C90
that I can check.
 
K

Keith Thompson

Lew Pitcher said:
In K&R C ("The C Programming Language", Appendix A, section 8.2 "Type
Specifiers"), the authors enumerate the uses of the "long" type specifier
thusly:
The words long, short, and unsigned may be thought of as adjectives; the
following combinations are acceptable.
short int
long int
unsigned int
long float
The meaning of the last is the same as double.

Does "long float" still mean "double" in ISO Standard C (any vintage)?

No, "long float" is a constraint violation in C89/C90, C99, and C11.
 
J

jacob navia

Le 12/03/2014 05:19, Lew Pitcher a écrit :
In K&R C ("The C Programming Language", Appendix A, section 8.2 "Type
Specifiers"), the authors enumerate the uses of the "long" type specifier
thusly:
The words long, short, and unsigned may be thought of as adjectives; the
following combinations are acceptable.
short int
long int
unsigned int
long float
The meaning of the last is the same as double.

Does "long float" still mean "double" in ISO Standard C (any vintage)?

No, but soon, I will implement in the lcc-win system "short float", to
describe 16 bit floating point numbers introduced some years ago, and
used widely in GPUs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top