By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,300 Members | 1,795 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,300 IT Pros & Developers. It's quick & easy.

Floating Point Formats are not linked

P: n/a
hi

Its been Given that Which error are you likely to get when you run the
following program?

main()
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i;
for(i=0;i<=9;i++)
scanf("%s%f", e[i].name,&e[i].sal);
}

The answer given is Floating point formats are not linked.

so why this error will come ?

Aug 1 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Before I get on to what neha said, I'll make a prediction, based purely on
the subject line. My prediction is that he's using a Borland compiler.

neha said:
hi

Its been Given that Which error are you likely to get when you run the
following program?

main()
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
Here's another prediction: if neha adds the following line of code, the
problem will vanish:

double DidBorlandEverFixThisProblem = 3.14159;
int i;
for(i=0;i<=9;i++)
scanf("%s%f", e[i].name,&e[i].sal);
}

The answer given is Floating point formats are not linked.

so why this error will come ?
Implementation bug, IMHO.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Aug 1 '06 #2

P: n/a

Richard Heathfield wrote:
Before I get on to what neha said, I'll make a prediction, based purely on
the subject line. My prediction is that he's using a Borland compiler.

neha said:
hi

Its been Given that Which error are you likely to get when you run the
following program?

main()
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];

Here's another prediction: if neha adds the following line of code, the
problem will vanish:

double DidBorlandEverFixThisProblem = 3.14159;
int i;
for(i=0;i<=9;i++)
scanf("%s%f", e[i].name,&e[i].sal);
}

The answer given is Floating point formats are not linked.

so why this error will come ?

Implementation bug, IMHO.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
hi

whts the point in adding this double variable and i want to know when
and why this error" Floating point formats are not linked" usually
comes.

thanks
neha

Aug 1 '06 #3

P: n/a
neha said:

<snip>
>
hi

whts the point in adding this double variable and i want to know when
and why this error" Floating point formats are not linked" usually
comes.
It seems to be a bug in the Borland compiler. I've encountered it a number
of times in the past. Adding the double seems to kick the compiler into
noticing that linking in the math library would be a good plan.

Clearly, adding the double should not be necessary.

Borland has had this bug for a million years or so. It's a great shame,
because the first rule of debugging is "it's my fault - don't blame the
compiler - it's my fault - don't blame the compiler..." but this does
appear to be an exception that can occur all too frequently. Borland also
seems to have an issue with errno, by the way, so watch out for that.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Aug 1 '06 #4

P: n/a

hi
Actaually i have read this prob from the and in the book the reason
given for this error is:

When the compiler encounters a reference to the address of a float it
sets a flag to have the linker link in the floating point emulator.A
floating point emulator is used to manipulate floating point numbers in
runtime library functions like scanf() and atof() .There are some cases
in which the reference to the float is bit obsure and the compiler does
not detect the need for the emulator.

these suitations usually occurs during the intial stages of program
development .Normaly once the prog is fully developed ,the emulator
will be used that the complier can accurately determine when to link
the emulator.

To force linking of the floating piont emulator into an application
just include the following function in your program

void LinkFloat(void)
{
float a=0,*b=&a;
a=*b;
}
so is that mean that whenever this kind of error comes we should force
linking this emulator.wht does this above code do.

Aug 1 '06 #5

P: n/a
In article <11**********************@h48g2000cwc.googlegroups .com"neha" <ne*********@gmail.comwrites:
Richard Heathfield wrote:
Before I get on to what neha said, I'll make a prediction, based purely on
the subject line. My prediction is that he's using a Borland compiler.
....
Here's another prediction: if neha adds the following line of code, the
problem will vanish:

double DidBorlandEverFixThisProblem = 3.14159;
....
Implementation bug, IMHO.
....
whts the point in adding this double variable and i want to know when
and why this error" Floating point formats are not linked" usually
comes.
To overcome a well-known bug in a certain compiler.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Aug 1 '06 #6

P: n/a
On 1 Aug 2006 04:17:54 -0700, "neha" <ne*********@gmail.comwrote in
comp.lang.c:
hi

Its been Given that Which error are you likely to get when you run the
following program?

main()
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i;
for(i=0;i<=9;i++)
scanf("%s%f", e[i].name,&e[i].sal);
}

The answer given is Floating point formats are not linked.

so why this error will come ?
How did you miss this question:

"14.13 I'm having trouble with a Turbo C program which crashes and
says something like ``floating point formats not linked.''"

In the FAQ for comp.lang.c when you read it before posting here?

You DID read it before posting here, didn't you?

A link to the FAQ is in my signature. You might find the ANSWER to
the question useful.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Aug 1 '06 #7

P: n/a
In article <11**********************@i3g2000cwc.googlegroups. com"neha" <ne*********@gmail.comwrites:
To force linking of the floating piont emulator into an application
just include the following function in your program

void LinkFloat(void)
{
float a=0,*b=&a;
a=*b;
}

so is that mean that whenever this kind of error comes we should force
linking this emulator.wht does this above code do.
So, because it is documented, it is not a bug, but a feature...
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Aug 2 '06 #8

P: n/a

Thanks for the explanations!. Jack it was my mistake i havent read it
before

Neha

Aug 3 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.