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 5941903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:10:33+00:00 2026-05-22T16:10:33+00:00

I have created following program to find the bit pattern of floating point no.

  • 0

I have created following program to find the bit pattern of floating point no. but i got different then i calculated:

#include<stdio.h>

int main(void){
    float f = 1.234;
    char *ch;
    ch = (char *)(&f);
    printf("\n%d\n", *ch);
    ch++;
    printf("\n%d\n", *ch);
    ch++;
    printf("\n%d\n", *ch);
    ch++;
    printf("\n%d\n", *ch);

//  printf("%d %d %d %d", *ch, *(ch+1), *(ch+2), *(ch+3));
    printf("\n%f %e", f, f);
    return 0;
}

It gives me output:

-74

-13

-99

63

1.234000 1.234000e+00

What does it mean because i was expecting bit pattern as:

00111111 10111011 11100111 0110110

where i am wrong please correct me

  • 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-22T16:10:34+00:00Added an answer on May 22, 2026 at 4:10 pm

    I’m not sure where you got that bit pattern from.

    For IEEE-754, 1.234 is equivalent to an underlying representation of 0x3F9DF3B6 (see e.g. http://babbage.cs.qc.edu/IEEE-754/Decimal.html). So we have:

    0x3F = 00111111 =  63
    0x9D = 10011101 = -99 (as a signed char)
    0xF3 = 11110011 = -13
    0xB6 = 10110110 = -74
    

    Depending on your system endianness, you might find that these bytes come up in the other order.

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

Sidebar

Related Questions

I have created a static library following this link . But I am facing
I have created following rule in the .htaccess file located at the root of
I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
I have created the following C library for reading an image: typedef struct {
I have created the following project structure for my new asp.net mvc project any
I have created the following vsct file xml. <?xml version=1.0 encoding=utf-8?> <CommandTable xmlns=http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable xmlns:xs=http://www.w3.org/2001/XMLSchema>
Hey Guys, i have created the following Menu Structure: <div id=menu> <ul> <li><a href=#>Main
I have a created a following renderer which renders the JTree with checkboxes and
I have an ExpenseType object that I have created with the following migration: class
I have created a certificate using the following SSL command: makecert -r -pe -n

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.