473,513 Members | 11,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Floating Point Formats are not linked

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
8 5755
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

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
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

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
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
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
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

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

Neha

Aug 3 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6494
by: Ravi | last post by:
Is there anything wrong with this program? #include <stdio.h> int main() { struct emp { char name; float sal;
4
9542
by: Rajesh | last post by:
struct symbol { char ch; float probability; char *codeword; }; void get_user_input(struct symbol **sptr) { .....
10
18739
by: Bryan Parkoff | last post by:
The guideline says to use %f in printf() function using the keyword float and double. For example float a = 1.2345; double b = 5.166666667; printf("%.2f\n %f\n", a, b);
33
2725
by: dis_is_eagle | last post by:
hi....i have encountered strange problem regarding floating point comparison...the problem is... main() { float a=0.7; if(0.7 a) printf("hi"); else printf("hello");
70
3524
by: Robert Gamble | last post by:
9899:1999 5.1.2.3 Example 4 reads: "EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate semantics. Values are independent of whether they are represented in a...
23
638
by: ultimatewarrior | last post by:
Hi all, first of all I beg your pardon if this question has been asked before, but I was unable to find anything in the past posts. I have written a piece of code that was supposed to be quite...
39
3520
by: rembremading | last post by:
Hi all! The following piece of code has (for me) completely unexpected behaviour. (I compile it with gcc-Version 4.0.3) Something goes wrong with the integer to float conversion. Maybe somebody...
4
6931
by: mathieu | last post by:
Hello, Has anyone heard of the 'half' floating point type. That would be a 16bits floating point, see for example: http://oss.sgi.com/projects/ogl-sample/registry/ARB/half_float_pixel.txt ...
14
2822
by: mathieu | last post by:
hi there, I do not understand the syntax for ios_base::precision. Let say I have a floating point: const float f = 0.313244462; How do I write is to a stream ? const float f =...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.