Floating Point Formats are not linked

Discussion in 'C Programming' started by neha, Aug 1, 2006.

  1. neha

    neha Guest

    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.name,&e.sal);
    }

    The answer given is Floating point formats are not linked.

    so why this error will come ?
     
    neha, Aug 1, 2006
    #1
    1. Advertising

  2. 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.name,&e.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)
     
    Richard Heathfield, Aug 1, 2006
    #2
    1. Advertising

  3. neha

    neha Guest

    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.name,&e.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
     
    neha, Aug 1, 2006
    #3
  4. 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)
     
    Richard Heathfield, Aug 1, 2006
    #4
  5. In article <> "neha" <> writes:
    > 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/
     
    Dik T. Winter, Aug 1, 2006
    #5
  6. neha

    neha Guest

    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.
     
    neha, Aug 1, 2006
    #6
  7. neha

    Jack Klein Guest

    On 1 Aug 2006 04:17:54 -0700, "neha" <> wrote 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.name,&e.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/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Aug 1, 2006
    #7
  8. In article <> "neha" <> writes:
    > 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/
     
    Dik T. Winter, Aug 2, 2006
    #8
  9. neha

    neha Guest

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

    Neha
     
    neha, Aug 3, 2006
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravi

    Floating point formats not linked

    Ravi, Nov 8, 2003, in forum: C Programming
    Replies:
    3
    Views:
    4,387
    Mark McIntyre
    Nov 8, 2003
  2. John Pye
    Replies:
    4
    Views:
    401
    John Pye
    Jan 25, 2007
  3. Skybuck Flying

    Accessing array elements via floating point formats.

    Skybuck Flying, Dec 10, 2010, in forum: C Programming
    Replies:
    33
    Views:
    1,053
    Andrew Reilly
    Dec 17, 2010
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,408
    Saraswati lakki
    Jan 6, 2012
  5. teeshift
    Replies:
    2
    Views:
    289
    Chris Pearl
    Dec 1, 2006
Loading...

Share This Page