How to take input as fractional number without using float/double data type?

Is it possible to take a decimal number as input from the user without using float/double data type?

And this number has to be used further for calculation.

I'm making a function to calculate square root of a number without using cmath library, I'm doing this for a DSP that doesn't have FPU so I can't use float/double.

If I will be using string to take input of decimal number from the user then how can I convert it into a number, and if it is converted into a number then what should be the return type of the square root function (the root will be a fractional number)?

If possible please suggest some alternative way instead of stings.
Last edited on
You can't use float or double or string ... what exactly can you use?

So, for example, you want the square root of 5. And you don't want to use float or double?
Last edited on
except for floating point data type (float, double) anything can be used.

Google around "fixed point arithmetic".
@Duthomhas I know about fixed point arithmetic and I want to use the same but I don't know how to implement it, that's why I asked this on the forum.
Topic archived. No new replies allowed.