Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7534749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:06:31+00:00 2026-05-30T06:06:31+00:00

Given a two floating point Numbers A and B, which are command line arguments,

  • 0

Given a two floating point Numbers A and B, which are command line arguments, I must create methods to do bitwise operations on them. Including And, Or, Not, xOr, floating Point addition etc…

How can I access each bit in C? I need to access the specific 1’s and 0’s. Any idea how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:06:33+00:00Added an answer on May 30, 2026 at 6:06 am

    Here’s an example using unions, as Keith suggests.

    
    /* -std=c99 */
    #include <stdio.h>
    
    int main(int argc, char * argv[]) {
    
      /* note, I'm assuming an int has the same size of a float here */
      assert( sizeof(unsigned int) == sizeof(float) );
    
      union {
        float floating;
        unsigned int integer;
      } a;
    
      a.floating = 3.14;
    
      /* prints the bits in reverse order */
      unsigned int temp = a.integer;
      for( int i = 0; i < sizeof(float)*8; i++ ) {
        printf("%d", temp & 0x1);
        temp = temp >> 1;
      }
    }
    
    

    EDIT: changed signed ints to unsigned.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given two floating-point numbers, I'm looking for an efficient way to check if they
I'm having trouble with Floating Point Addition in C. We're given two 16 bit
Given two tables, one for workers and one for tasks completed by workers, CREATE
I just read this nice answer given on how to compare floating-point values for
I'm trying to understand a paper on lossless compression of floating point numbers and
Let's say I have an array of floating point numbers, in sorted (let's say
Given two degrees on a 360 degree circle. Lets call them Source and Destination.
Given two consecutive 3D point clouds 1 and 2 (not the whole cloud, say
Given two lists, which contain same elements of string but in different orders, is
Given two implementations of Comparison methods: // compares by Key... private static int CompareByKey(KeyValuePair<int,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.