Convert from Byte to Megabyte

  • I'm reading a iSeries file and it returns its size in bytes, how can I convert bytes into megabytes?

  • divide the number by 1,024. :w00t:

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • 🙂 thanks!!

  • Jason Selburg (11/27/2007)


    divide the number by 1,024. :w00t:

    unless the hardware is IBM, in which case 1MB=1,000 bytes. (edit) I mean - Kbyte (duh), which means it could be any of the following:

    1MB = 1,000,000 bytes (IBM)

    1MB = 1,024,000 bytes (sony)

    1MB = 1,048,576 bytes (damn near everyone else)

    Would be nice if I saw what I read...wow.

    (end edit)

    No - I am not kidding.

    Leave it to IBM to screw up a perfectly good standard....

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Um... no, I don't think so... a Mega byte is a binary million bytes, not a binary thousand.

    Convert from Bytes to KBytes by dividing by 1,024.

    Convert from Bytes to MBytes by dividing by 1,0242 or 1,048,576.

    Convert from Bytes to GBytes by dividing by 1,0243 or 1,073,741,824.

    Dunno about IBM...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (11/27/2007)


    Um... no, I don't think so... a Mega byte is a binary million bytes, not a binary thousand.

    Convert from Bytes to KBytes by dividing by 1,024.

    Convert from Bytes to MBytes by dividing by 1,0242 or 1,048,576.

    Convert from Bytes to GBytes by dividing by 1,0243 or 1,073,741,824.

    Dunno about IBM...

    oh I don't disagree. but IBM did pull a rabbit there.... Just pointing out the VHS vs BETAMAX standards out there...

    Really - take a look: Wikipedia - Megabyte

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Heh... wasn't so concerned about IBM as I was that folks thought a megabyte was either 1,000 bytes or 1,024 bytes. Thanks for the edit...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • You guys and your details! :w00t:

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • Heh... speaking of "details"... once done and you go to format it, you wanna use commas or periods for the thousand separators? 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jason Selburg (11/28/2007)


    You guys and your details! :w00t:

    Yeah, really - what's the big deal about a few zeroes....:hehe:

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Jeff Moden (11/28/2007)


    Heh... speaking of "details"... once done and you go to format it, you wanna use commas or periods for the thousand separators? 😀

    That's a presentation issue - let the GUI folks deal with it:)

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Jeff Moden (11/28/2007)


    Heh... speaking of "details"... once done and you go to format it, you wanna use commas or periods for the thousand separators? 😀

    FYI, in France they use a blank for the thousands separator.

    That really caught me off guard one day.

    What's really bad about the choice of a blank for the thousands separator is that it really gets squeezed in most fonts.

  • That's a presentation issue - let the GUI folks deal with it

    Heh... That would be true for outputs... imported files are a whole (or is it "hole"?) 'nuther story. :hehe:

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Michael Meierruth (11/29/2007)


    Jeff Moden (11/28/2007)


    Heh... speaking of "details"... once done and you go to format it, you wanna use commas or periods for the thousand separators? 😀

    FYI, in France they use a blank for the thousands separator.

    That really caught me off guard one day.

    What's really bad about the choice of a blank for the thousands separator is that it really gets squeezed in most fonts.

    Heh... rumor has it that's because the old treasurer for France had a typewriter where the comma key didn't work... 😛

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • LOL -- That's funny!

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic. Login to reply