473,671 Members | 2,580 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 5767
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 DidBorlandEverF ixThisProblem = 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 DidBorlandEverF ixThisProblem = 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************ **********@h48g 2000cwc.googleg roups.com"neha" <ne*********@gm ail.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 DidBorlandEverF ixThisProblem = 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*********@gm ail.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.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Aug 1 '06 #7
In article <11************ **********@i3g2 000cwc.googlegr oups.com"neha" <ne*********@gm ail.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
6506
by: Ravi | last post by:
Is there anything wrong with this program? #include <stdio.h> int main() { struct emp { char name; float sal;
4
9552
by: Rajesh | last post by:
struct symbol { char ch; float probability; char *codeword; }; void get_user_input(struct symbol **sptr) { .....
10
18758
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
2758
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
3592
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 register or in memory. For example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load is required to round to the precision of the storage type. In particular, casts and assignments are...
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 portable, and uses a lot fp numbers. Everything goes well on PPC cpus, but on some x86 CPU I get a dramatic loss of performance. After some investigations I've discovered that the problem is caused by some numbers becoming subnormal, PPC cpus...
39
3553
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 out there understands what happens. Essentially, when I subtract the (double) function value GRID_POINT(2) from a variable which has been assigned the same value before this gives a non-zero result and I really do not understand why.
4
6946
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 Has anyone seen this type implemented in a C/C++ compiler ? Thanks
14
2842
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.313244462;
0
8485
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8403
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8677
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5704
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4417
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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 we have to send another system
2
1816
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.