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

  • SEARCH
  • Home
  • 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 6072793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:11:58+00:00 2026-05-23T10:11:58+00:00

Can you count on a semi-modern processor being able to do floating-point calculations with

  • 0

Can you count on a semi-modern processor being able to do floating-point calculations with a piece of data the same size as a pointer? Is there a defined type (possibly in a platform-specific header file) for such a type? I’m after the effect of intptr_t but for floats.

Edit:
I’m not referring to C’s float type, but to floating-point numbers in general.

Edit:
Do I need to just have a script run, testing what the sizes of float, double, and void * are for the compiler being used, and generate an appropriate header file to typedef a type that other code uses?

  • 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-23T10:11:59+00:00Added an answer on May 23, 2026 at 10:11 am

    The closest you will get is:

    union floatptr_t {
        float f;
        void *p;
    };
    

    On the down side, this is not exactly what you asked for. On the bright side, it is 100% standard…

    [edit]

    Yes, you could use sizeof to compare your pointer size to float, double, and long double, and pick one. But as @R. points out, many pointer values will map to NaN, so you will not be able to do anything with those floating point values other than cast them back to a pointer… And even that is not guaranteed to work (although it probably will in practice).

    But if you cannot do anything with the floating point value except cast it back to a pointer, then you are better off using a union, since that will be just as space-efficient and will actually work portably.

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

Sidebar

Related Questions

In the 10 years I've been programming, I can count the number of data
Is there a way I can count the size of an associated collection without
Given data s<-c(1,0,0,0,1,0,0,0,0,0,1,1,1,0,0) I can count 1s and 0s with table or ftable ftable(s,row.vars
I can count the rows in the dataset that the table consumes, but this
I have a table and can count the number of rows using var count
I would like to know how I can count the number of unique values
How can I count the number of elements in an array, because contrary to
How can I count operations in C++? I'd like to analyze code in a
How can I count how many previous FootNoteReference nodes there are in an xml
How can i count the number of stored procedures in my database and is

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.