Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type-casting ac_float instances to ordinary floats or doubles #28

Open
AnastKap opened this issue Dec 4, 2024 · 0 comments
Open

Type-casting ac_float instances to ordinary floats or doubles #28

AnastKap opened this issue Dec 4, 2024 · 0 comments

Comments

@AnastKap
Copy link

AnastKap commented Dec 4, 2024

Hello to all,

I have an arbitrary precision floating point variable ac_float<17,2,7>, which I want to typecast in double through the following line of code:

ac_float<17,2,7> x;
double temp = (double)x;

Is there any way to do that? As far as I can see, the ac_ieee_float class has an operator for that

explicit operator double() const {
  double f;
  ac::copy_bits(d, &f);
  return f;
}

Is there any reason for which this type of operator doesn't appear in the ac_float class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant