Shift exponent and comma to match (normalize)

This is a discussion on Shift exponent and comma to match (normalize) within the C++ Programming forums, part of the General Programming Boards category; How can I Normalize two float numbers Suppose the input of users as this 1.98 x 10E 4 = 19800 ...

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    13

    Shift exponent and comma to match (normalize)

    How can I Normalize two float numbers


    Suppose the input of users as this

    1.98 x 10E 4 = 19800
    21.22 x 10E5 = 2120000

    But I need to set them as

    0.19 x 10 E -5
    and the second one must be 0 in the first digit and must be the same exponent
    0.2122 x 10E-6 -> as this is greater than first I must move the coma of the first one

    0.019 x 10 E -6
    0.2122 x 10 E -6

    I need to make this in a single function

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    You can try looking at this thread

    How to normalize two numbers.

    or if that doesn't help, maybe this thread will

    Normalize again.

    and, if all else fails, try

    Shift exponent and comma to match (normalize)
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    13
    Very Funny.

  4. #4
    Chief Code Coloniser!
    Join Date
    Apr 2005
    Posts
    121
    He's trying to tell you in a very nice way....

    ... DO NOT CROSSPOST OR DOUBLEPOST.

    One question... one thread.

    I mean that in the nicest possible way

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    13
    Did somebody answer on the other posts?

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,485
    > Did somebody answer on the other posts?
    Doesn't look like it - but not getting an answer is not an excuse to spam the board with the same question over and over, without showing any signs of actual progress.

    Consider http://www.opengroup.org/onlinepubs/...xsh/frexp.html
    And comparing the exponents of both floats (say -4 and -7)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Apr 2005
    Posts
    13
    Thanks

Popular pages Recent additions subscribe to a feed

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