803 Subj : problem with math exp(log(2)) To : borland.public.cpp.borlandcpp From : Bostjan Stupica Date : Fri Mar 19 2004 08:30 am Hoj! I have problem with the following program in step/case 2. In step 2 I expect the result to be 8 in int and double type of variables. I tried to compile program in Borland C++, MinGW and gcc (on Linux) and get the same result. Anyone had similar problem??? The program is: --- #define STRICT // Strict syntax and field maping #define WIN32_LEAN_AND_MEAN /* -----------------< INCLUDE Directives. >---------------------------------- */ #include #include /* -------------------------------------------------------------------------- */ #ifdef __TURBOC__ #pragma argsused #endif // Function: main int main(int argc, char **argv) { // Local variables int i_number; long l_number; float f_num; double f_number; // Initialization // Output string printf("========================================"); printf("=======================================\n"); printf("This is TEST program for numeric calculation and typecast."); printf("\n"); // Calculation f_number = exp(log(2) * 2); i_number = (int) f_number; // Output variables printf("1.\n"); printf("Var: %ld <> %.2f", i_number, f_number); printf("\n"); // Calculation f_num = exp(log(2) * 3); f_number = exp(log(2) * 3); i_number = (int) f_number; l_number = (long) f_number; // Output variables printf("2.\n"); printf("Var: %ld <> %ld <> %.2f <> %.2f", i_number, l_number, f_num, f_number); printf("\n"); // Calculation f_number = exp(log(2) * 4); i_number = (int) f_number; // Output variables printf("3.\n"); printf("Var: %ld <> %.2f", i_number, f_number); printf("\n"); // End of program return 0; } // main --- Regards, BostjanSt EMail: bostjanstupica@bankart.si . 0