How do I swap 64-bit and 32-bit floats from little-endian to big-ending

I am trying to read a file that could contain a list of 64-bit floats or 32-bit floats that were written on a PC so they are little-endian.
I need to convert the float values to big-endian so that I can process the values. I know that straight swapping each byte with the adjacent byte doesn't work (especially since their floating point values). I've tried swapping them end for end (i.e., byte 15 from the file becomes byte 0 in my array) and that didn't work either.
I know that if I were to read the little-endian float into the big-endian float type (float or double) that the format is pretty much lost (from little I understand about how floating point values are stored in memory).
So, what I need is a way to read in a series of little-endian floating point values (64-bit and 32-bit) into a big-endian array of floating point values.
Anyone have any ideas on how to do this? Any help would be much appreciated.

A 64-bit double is represented by the sign bit, an 11-bit (biased) exponent
followed by a 52-bit mantissa. Both x86 and SPARC use the exact same
representation for 64-bit double. The only difference is the endianness
when stored to memory, as you observed.
A 32-bit float is represented by the sign bit, an 8-bit (biased) exponent
followed by a 23-bit mantissa. Again, both x86 and SPARC use the exact
same representation for 32-bit float modulo endianness.
As you can see, a 64-bit double is not merely a pair of 32-bit float.
You need to know exactly how the floating-point data was written:
if a 32-bit float was written, you must endian-swap it as a 32-bit float;
if a 64-bit double was written, you must endian-swap it as a 64-bit double.

Similar Messages

  • How can I swap the Fn and Ctrl keys on ideacentre b550 touch?

    How can I swap the Fn and Ctrl keys on ideacentre b550 touch?

    The BIOS feature that you request already exists.
    1.  reboot the computer
    2.  press F1 to enter BIOS setup
    3.  config -> keyboard/mouse -> Fn and Ctrl Key swap

  • How can I change game centre and iCloud account information from previous owner of my iPad?

    How can I change game centre and iCloud account information from previous owner to me?

    You can't do it on your own. The previous owner has to erase the device for you. You would need his Apple ID and password in order to delete his iCloud account. This is due to the Activation Lock in iOS 7 - assuming that your iPad is running iOS 7.
    Contact the owner and ask home to erase it remotely using iCloud, or return the device and ask for your money back. If you can't contact the pervious owner, you will have a useless iPad on your hands.
    Read this for more information. This is what you need the previous owner to do.
    What to do before selling or giving away your iPhone, iPad, or iPod ...

  • I have two companies sending me indesign documents. One opens up and the dictionary is set to English. The other file opens at is in Hebrew, Not sure how to fix the Hebrew part and whether or not the fualt lies at my end or at the other end

    I have two companies sending me indesign documents. One opens up and the dictionary is set to English. The other file opens at is in Hebrew, Not sure how to fix the Hebrew part and whether or not the fault lies at my end or at the other end

    If only the language is Hebrew, you should correct it in the Paragraph and Character Styles.
    But in such a case I would expect more problems.
    If you are a creative cloud subscriber you should additionally install the InDesign version, English with Hebrew support:
    Go to the preferences of you CC.app. It is found behind the Gear Symbols on the top right.
    When the preferences open, go to the Apps section.
    Change the App Language to English with Hebrew support.
    Now you can install it. It will install on the very same place where your InDesign program is found some additional plugins, which will give you access to Hebrew functionality, like RTL text. Otherwise you will inherit in the document (and where you copy and paste it from such a document into another one). But now you can change or repair problems.
    Now repeatstep 1 + 2, but you need not to install your own language again. InDesign will now, when started, run in the language of your OS (when you have it installed in that language) but with more functionality to handle problems with Hebrew documents.
    The same steps you would have to do with Arabic or Asian documents. These languages will also add more plugins. But keep it limitted to those language you need. I have installed it that way, because I get sometime documen where the text flows the wrong direction or the numbers come up in Farsi digit, not in Arabic digits. For such purposes I need versions in languages I don’t understand myself.

  • TS1702 How can I transfer a game and game files (Minecraft) from my iphone to my grandson's new ipod touch.  Is there a way to do it without having to restore his ipod from my iphone?

    How can I transfer a game and game files (Minecraft) from my iphone to my grandson's new ipod touch.  Do I have to restore the ipod from my iphone or can I just transfer this one game (plus files).

    Back your device via icloud and restore on other ipod via icloud.

  • How can I swap my photos and the apps I have paid for, from my iphone 4s to iphone 5?

    I am having trouble swapping my photos and videos along with my paid apps to my new phone
    I dont have access to a computer and cant let my old phone go until I have all the pictures.
    Also have a few apps i have paid for.
    Please can someone advise me on this.
    Thank you

    Have you set up the new phone yet?
    If you did you missed it.
    On the iPhone 5:
    Settings > General > Reset > Erase All Contents & Settings
    When it finishes choose the restore from iCloud backup option

  • How to get both, the ResultSet and Output (return value) from Oracle Stored Procedure

    Hi! I am doing a conversion from MSSQL to Oracle with C++ and MFC ODBC. Any comment is appreciated!! I have Oracle 8i and Oracle ODBC 8.1.6 installed.
    My question is how to retrieve the return value AND ALSO the resultSet at the same time by using Oracle function without modifying my souce codes (except puttting mypackage. string infron of my procedure name, see below).
    -- My source code in C++ with MSSQL ....
    sqlStr.Format("{? = call ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    Where CustoemrList is a Crecordset object...
    IN DoFieldExchange(CFieldExchange* pFX) I have ...
    //{{AFX_FIELD_MAP(CQOSDB_Group)
    pFX->SetFieldType(CFieldExchange::outputColumn);
    RFX_Long(pFX, T("Name"), mCustoemrName);
    //}}AFX_FIELD_MAP
    // output parameter
    pFX->SetFieldType( CFieldExchange::outputParam );
    RFX_Int( pFX, T("IndexCount"), mCustomerNumber);
    -- m_CustomerNumber is where i store the return value!!!
    -- In Oracle Version, i have similar codes with ...
    sqlStr.Format("{? = call mypackage.ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    -- I have oracle package/Body codes as following...
    create or replace package mypackage
    as
    type group_rct is ref cursor;
    Function listgroups(
    nameID NUMBER ,
    RC1 IN OUT Mypackage.group_rct ) return int;
    end;
    Create or replace package body mypackage
    as
    Function listgroups(
    NameID NUMBER ,
    RC1 IN OUT Mypackage.group_rct )return int
    IS
    BEGIN
    OPEN RC1 FOR SELECT Name
    from Customer
    WHERE ID = NameIDEND ListGroups;
    END
    return 7;
    END listgroups;
    END MyPackage;
    Ive simplified my codes a bit....
    null

    yes, it is exactly what i want to do and I am using Oracle ODBC driver.
    I tried using procedure with 1 OUT var fo numeric value and the other IN OUT ref cursor var instead of function, but error occurs when I called it from the application. It give me a memory ecxception error!!
    sqlStr.Format("{? = call ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    it seems to me that the ? marker var is making all the trouble... can you please give me any more comment on this?? thanks!
    null

  • How do I move all photos and catalog (PE 6)  from local computer drive to network server drive?

    I'm using PE 6. I have about 40 GB of photos all organized and cataloged on my local PC's hard drive. I have just installed a home server that is networked and want to move/migrate all the photos and catalog information/organization from my local PC drive to the home server's hard drive. Basically, just moving everything to a new drive. I then need to point PE 6 to this new location for the photos and catalog information. All advice on how to do this would be appreciated?

    I just got done doing this and I'm not so sure I'd recommend it.
    #1 reason: The #$%%#$ Organizer has REAL PROBLEMS figuring out network path names. It has this really nasty habit of thinking, say, \\homeserv\photos, \\Homeserv\Photos, and \\HOMESERV\PHOTOS are DIFFERENT paths. And depending on how you use it to navigate, or drag and drop files onto it, or teach it to watch a folder on a network drive or whatever, it uses variants on these kinds of path names. This leads to problems like duplicate imports that are really the same file.
    What a ***.
    You MIGHT have better luck if you use a mapped drive letter to make this work. Sad. The rules for writing WinApps to NOT NEED mapped drive letters have been common knowledge to developers for a decade. Just not Adobe developers, apparently. Beyond sad. Pathetic.

  • I just got the 4s and my computer broke so I don't have a way to sync my new phone how do I get my contacts and games on it from old iPhone?

    Help how do I sync my new 4s when I have no comPuter inorder to get contacts apps and games onto it

    Find a computer with iTunes 10.5 and create a backup from the old phone and then restore from backup on the 4s.

  • How to stop scheduled ship date and scheduled arrival date from defaulting to sysdate

    Hello,
    We have a business scenario where we are deriving scheduled ship date and scheduled arrival date outside and then imported in the instance with the order. However we find that the scheduled ship date and scheduled arrival date are defaulting to sysdate. The atp flag is set to N for these items. I have checked the defaulting rules, there is no such defaulting rule set for scheduled ship date or arrival date ( screenshot attached) Please share your thoughts on how can I stop scheduled ship date and arrival date date from defaulting to sysdate ?
    Thanks
    Rajesh

    Hi
    Please visit following link. It may be useful.
    How to prevent auto default of schedule ship date in sales order form
    HTH
    sd

  • How do you get 32-bit float effects to work with an alpha channel?

    I make a few bugs and lower thirds, but I'm having a lot of trouble getting 32-bit float effects to correctly export with transparency.
    When I make semitransparent animations with bright lighting effects, they look great in AE but I can't seem to find any way to bring them over to Final Cut and get them to look like they should.
    I've attached this example of a bug with a screenshot from AE on the left and from FCP on the right. The colors dim and the vibrant blue gradients get flattened into a dull greenish color.
    So far as I can tell, all my alpha and color management settings are correct. I've tried endless settings options and codec options to try to fix this, to no avail.
    You can create an extreme case as an example by creating a semitransparent shape, cranking the color way up to a saturated superwhite color, and moving it around with motion blur. The render looks pretty much just like a 8/16 bit render, and nothing like it did in your canvas.
    I have a feeling the way AE multiplies the superwhite color values with the alpha channel gets "lost in translation" when it is rendered to 4 8-bit channels. Is there any way to get it to look the way it does in the canvas?
    Thanks,
    Clint

    Thanks so much for your ideas. I'd already tried experimenting with a number of color management options, including 'Preserve RGB' and turning off 'Convert to Linear Light' but they didn't fix it. I had also already tried using the "None" option from the codec menu.
    I pulled it back into AE, and it looks the same as it did in FCP.
    I'm starting to think the issue has something to do with AE rendering to a file differently than the way it renders to the canvas. For example, here's a fast moving 50% opaque superwhite shape in the AE canvas:
    I rendered this using Animation + Alpha using Best settings and 32-bit float, and reimported it into AE:
    I think the answer may lie in the fact that the first image looks solid white in some places, even though it is 50% transparent. It's almost like the excessive RGB values "bleed" over to the alpha channel. The rendered image (probably correctly) looks grey because it represents white at 50% opacity.
    What I want to do though, is find a way to make my render look like my canvas. So it seems I need to do two things to the image:
    1. Find a way to increase opacity in areas of excessive white, so that they are not grey in the render.
    2. Find a way to "bake" the superwhite colors to a level below 100% white so that they show up in the render.
    I tried the "Alpha from Max Color" effect and this seems to get kind of close, but unfortunately it discards other parts of the alpha channel (like drop shadows).
    It might also be helpful to know that when I have AE output to an external NTSC monitor (via Intensity card) the monitor shows the exact same artifacts as the render.

  • In VB how do I pass my low and high limit results from a TestStand Step into the ResultList and how do I retrieve them from the same?

    I am retrieving high and low limits from step results in VB code that looks something like this:
    ' (This occurs while processing a UIMsg_Trace event)
    Set step = context.Sequence.GetStep(previousStepIndex, context.StepGroup)
    '(etc.)
    ' Get step limits for results
    Set oStepProperty = step.AsPropertyObject
    If oStepProperty.Exists("limits", 0&) Then
    dblLimitHigh = step.limits.high
    dblLimitLow = step.limits.low
    '(etc.)
    So far, so good. I can see these results in
    VB debug mode.
    Immediately after this is where I try to put the limits into the results list:
    'Add Limits to results
    call mCurrentExecution.AddExtraResult("Step.Limits.High", "UpperLimit")
    call mCurrentExecution.AddExtraResult("Step.Limits.Low", "LowerLimit")
    (No apparent errors here while executing)
    But in another section of code when I try to extract the limits, I get some of the results, but I do not get any limits results.
    That section of code occurs while processing a UIMsg_EndExecution event and looks something like this:
    (misc declarations)
    'Get the size of the ResultList array
    Call oResultList.GetDimensions("", 0, sDummy, sDummy, iElements, eType)
    'Step through the ResultList array
    For iItem = 0 To iElements - 1
    Dim oResult As PropertyObject
    Set oResult = oResultList.GetPropertyObject("[" & CStr(iItem) & "]", 0)
    sMsg = "StepName = " & oResult.GetValString("TS.StepName", 0) & _
    ", Status = " & oResult.GetValString("Status", 0)
    If oResult.Exists("limits", 0&) Then
    Debug.Print "HighLimit: " & CStr(oResult.GetValNumber("Step.Limits.High", 0))
    Debug.Print "LowLimit: " & CStr(oResult.GetValNumber("Step.Limits.Low", 0))
    End If
    '(handle the results)
    Next iItem
    I can get the step name, I can get the status, but I can't get the limits. The "if" statement above which checks for "limits" never becomes true, because, apparently the limit results never made it to the results array.
    So, my question again is how can I pass the low and high limit results to the results list, and how can I retrieve the same from the results list?
    Thanks,
    Griff

    Griff,
    Hmmmm...
    I use this feature all the time and it works for me. The only real
    difference between the code you posted and what I do is that I don't
    retrieve a property object for each TestStand object, instead I pass the
    entire sequence context (of the process model) then retrieve a property
    object for the entire sequence context and use the full TestStand object
    path to reference sub-properties. For example, to access a step's
    ResultList property called "foo" I would use the path:
    "Locals.ResultList[0].TS.SequenceCall.ResultList[].Foo"
    My guess is the problem has something to do with the object from which
    you're retrieving the property object and/or the path used to obtain
    sub-properties from the object. You should be able to break-point in the
    TestStand sequence editor immediately after the test step in question
    executes, then see the extra results in the step's ResultList using the
    context viewer.
    For example, see the attached sequence file. The first step adds the extra
    result "Step.Limits" as "Limits", the second step is a Numeric Limit (which
    will have the step property of "Limits") test and the third step pops up a
    dialog if the Limits property is found in the Numeric Limit test's
    ResultList. In the Sequence Editor, try executing with the first step
    enalbled then again with the first step skipped and breakpoint on the third
    step. Use the context viewer to observe where the Limits property is added.
    That might help you narrow in on how to specify the property path to
    retrieve the value.
    If in your code, you see the extra results in the context viewer, then the
    problem lies in how you're trying to retrieve the property. If the extra
    results aren't there, then something is wrong in how you're specifying them,
    most likely a problem with the AddExtraResult call itself.
    One other thing to check... its hard to tell from the code you posted... but
    make sure you're calling AddExtraResult on the correct execution object and
    that you're calling AddExtraResult ~before~ executing the step you want the
    result to show up for. Another programmer here made the mistake of assuming
    he could call AddExtraResult ~after~ the step executed and TestStand would
    "back fill" previously executed steps. Thats not the case. Also, another
    mistake he made was expecting the extra results to appear for steps that did
    not contain the original step properties. For example, a string comparison
    step doesn't have a "Step.Limits.High" property, so if this property is
    called out explicitly in AddExtraResult, then the extra result won't appear
    in the string comparison's ResultList entry. Thats why you should simply
    specify "Step.Limits" to AddExtraResul so the Limits container (whose
    contents vary depending on the step type) will get copied to the ResultList
    regardless of the step type.
    I call AddExtraResult at the beginning of my process model, not in a UI
    message handler, so there may be some gotcha from calling it that way. If
    all else fails, try adding the AddExtraResult near the beginning of your
    process model and see if the extra results appear in each step's ResultList.
    Good luck,
    Bob Rafuse
    Etec Inc.
    [Attachment DebugExtraResults.seq, see below]
    Attachments:
    DebugExtraResults.seq ‏20 KB

  • How do I delete old .mac and .me email addresses from the new iCloud email server?

    Now that I have iCloud, all the old .mac and .me email that I never used feeds through it.  Since there is no SPAM filter, I cannot block these emails from getting through and I get lots of spam now.   How do I delete the .mac and .me email addresses?
    Thanks.

    I  set the Rules months ago to automatically put all email sent to those email addresses in TRASH.  However, they still appear in my Mail Trash on my Mac.  Just an annoyance.    Thanks for the response.

  • How to backup a "show tech" and a "running config" from MDS switches

    hi, guys
    I am a newbie of MDS switches.
    but I got a request this week asking me to actively backup a "show tech" and a "running config" from the MDS switches........
    so my questions are:
    1) if I want to back up MDS configurations, which commnds should I run? or just "show tech" is enough?
    2) is the MDS itself have the backup function? for example can ftp the configuration to someplace?
    please help point me the right direction or is there any official referece docs I can refer to ?
    thanks in advance!!!

    tftp worked for me but not ftp. My ftp requires a password and I don't know how to send it via scheduler job.
    Worked:
    scheduler job name BkupConfig
      copy running-config startup-config
      copy startup-config tftp://10.1.1.1/MDS_Bkup/DowMDS$(TIMESTAMP).txt
    scheduler schedule name Weekly_5am
      job name BkupConfig
      time weekly 01:05:00
    FAILED FTP:
    Job Name       : test                              Job Status: Success (0)
    Schedule Name  : test                              User Name : user
    Completion time: Thu Sep  5 11:08:41 2013
    --------------------------------- Job Output ---------------------------------
    `copy running-config startup-config`
    [###                                     ]   6%
    [######                                  ]  12%
    [########                                ]  19%
    [###########                             ]  25%
    [##############                          ]  32%
    [################                        ]  39%
    [###################                     ]  45%
    [######################                  ]  51%
    [########################                ]  59%
    [###########################             ]  65%
    [#############################           ]  71%
    [################################        ]  79%
    [###################################     ]  85%
    [#####################################   ]  91%
    [########################################]  98%
    [########################################] 100%
    Copy complete, now saving to disk (please wait)...
    `copy startup-config
    ftp://[email protected]/MDS_Bkup/DowMDS2013-09-05-10.53.05.txt
    `
    Password: Login failed.

  • Bounced mail, how to fix iCloud "over quota", and I am far from it?

    We switched from MobileMe to iCloud.  Each of us have individual iCloud.  Any mail sent to my wife is bounced, reason?  Over quota!  I have checked iCloud storage and she has 3.9 Gb available.  Have tried every thing, even went to "Genius Bar" to no avail.  Have been trying to call Apple for help, two time waited 20 minutes and got disconnected.  Now my wife is using her G-mail with iCloud.  Can't use iCloud.  Any help will be welcome.  Unless you have a solution, please don't bother.
    Thanks.

    Polly,
    usually there are multiple models of MacBook Pro per model number, but in the case of your model number (A1502), there’s currently only one model for that model number: 13-inch Late 2013.
    To reset your MacBook Pro, you’ll need to boot into Recovery mode by holding down a Command key and the R key as you start it up. When the Mac OS X Utilities menu appears, select Disk Utility. On the left-hand side of the Disk Utility window, select your internal disk (most likely the top item of the list). On the right-hand side, select the Erase tab. For the Format dropdown, select “Mac OS Extended (Journaled)”. For the Name input box, “Macintosh HD” has traditionally been the default name — I don’t know if that’s still the case for the Late 2013 models. After that, press the Erase… button, and erase its entire internal disk. When it’s finished with the erasure, exit Disk Utility, and select Shut Down from the Apple menu. When you start it up again, OS X Internet Recovery will redownload Mavericks from Apple’s servers and reïnstall it on your internal disk. Once it has reïnstalled, run Software Update to get it up to date, and adjust the System Preferences to your taste.

Maybe you are looking for

  • How To Add new fields in report ( S_ALR_87012026 ) output

    Dear All Experts , .. I want to add  Asset  text description in the out but layout of report   S_ALR_87012026 please um really need a help thanks for advance .

  • Erro deploying Webdynpro - DC prerequisites

    Hi, We have just installed a SAP Java instance, SAP WAS 7.00 + ADS While testing for the correctness of the instalation i'm trying to deploy a simple hello world application. I'm using the NWDS 7.1 and i get the following error log: Jul 9, 2009 10:19

  • How can I read Safari mail on one computer that is on another computer?

    I have an iMac (Tiger) and a MBPro (Leopard). I usually download and read Safari mail on my iMac; however, there are times when I am using my MBPro that I would like to be able to read the mail that is on my iMac. I always remove my mail from the ser

  • Recover SMS Messages from Ovi Suite

    Hi, My memory card got corrupted and have lost all my SMS messages on my phone, but luckily I had synced my phone with Ovi Suite and I am able to see all my messages. Is it possible to get move all these messages back to my phone, I am not syncing my

  • Adobe premiere elements 12 video is slow and does not match sound

    after uploading the clip to edit into premiere elements 12 the video clip is slow, it doesnt match with the sound which is on point, when played back the video is choppy and skips a few clips, how to fix this please? this makes me reconsider actually