simon@simon_pc.UUCP (Simon Shapiro) (02/28/86)
I need help with the following 'program':
#include <stdio.h>
main()
{
double test;
test = 1234567.981;
printf("Test of double value %7.2f\n", test);
}
It runs fine on SV but produces the line "...value 7.2f" when compiled
on a PC clone with Lattice C version 2.15. Am I doing something wrong
or is this a bug? I tried the same with sprintf() but the same results.
Any mailed help will be greatly appreciated.
Simon Shapiro (voice = +1 415 933 9468)
...ihnp4!quantel!lll-crg!lll-lcc!simon_pc!simon
ejb@think.ARPA (Erik Bailey) (03/01/86)
In article <147@simon_pc.UUCP> simon@simon_pc.UUCP (Simon Shapiro) writes: >I need help with the following 'program': > > . . . > double test; > test = 1234567.981; > printf("Test of double value %7.2f\n", test); > . . . > >It runs fine on SV but produces the line "...value 7.2f" when compiled >on a PC clone with Lattice C version 2.15. Am I doing something wrong >or is this a bug? Well, lets call it a pseudo-bug. I had the SAME problem when I bought Lattice 2.14 (they did NOT send me the 2.14 update stuff! :-( ). The deal is that you have to link NOT ONLY LC?.LIB, but *also* LCM?.LIB [the M means Math -- it holds reals (your problem) as well as tan stuff, etc.]. Hope this helps... --Erik -- Erik Bailey -- 7 Oak Knoll (USENET courtesy of ihnp4!godot!ejb Arlington, MA 02174 Thinking Machines Corp. ejb@think.com.arpa (617) 643-0732 Cambridge, MA) It takes thought to make a program that thinks. But it takes work to make a program that works.
ark@alice.UucP (Andrew Koenig) (03/01/86)
> I need help with the following 'program': > #include <stdio.h> > > main() > { > double test; > test = 1234567.981; > printf("Test of double value %7.2f\n", test); > } > > It runs fine on SV but produces the line "...value 7.2f" when compiled > on a PC clone with Lattice C version 2.15. Am I doing something wrong > or is this a bug? I tried the same with sprintf() but the same results. > Any mailed help will be greatly appreciated. You need to link with the floating-point library (\lc\s\lcm, etc). Use the "linkms" script instead of the "links" script, etc...