Unreal results from FloatToStr function!!!!!!

This is a discussion on Unreal results from FloatToStr function!!!!!! within the Windows Programming forums, part of the Platform Specific Boards category; I cannot believe! My very easy and short program to make some basic math. operations with two numbers does not ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    2

    Angry Unreal results from FloatToStr function!!!!!!

    I cannot believe! My very easy and short program to make some basic math. operations with two numbers does not work as it has. Wath this: There are three classical Edit, and the button. The variable Result is a float type. Button procedure:
    ----------------------------------------------------------
    Result = 0;
    Result = (StrToFloat(Edit1->Text) - StrToFloat(Edit2->Text));
    Edit3->Text = Result;
    ----------------------------------------------------------
    Edit1->Text value was 59,26, Edit2->Text was 3,1
    and the Result shown in Edit3 is 62,3600006103516.

    How the f**k could this be possible? What are these
    decimals?!?1

    Thanx for answers my friends...

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    14
    try
    Code:
    Edit3->Text = FloatToStr(Result);
    good luck
    Dharius

  3. #3
    Unregistered
    Guest
    I may be wrong about this but it seems to me that I use

    atof(const char *string );

    to change an alpha character represented to a float.

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    14
    atof() is fine, and ANSI. But I think ma55acre uses CBuilder...
    Dharius

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  2. dllimport function not allowed
    By steve1_rm in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2008, 03:33 AM
  3. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 12:49 PM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 10:00 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21