# Is there a way to find the integer representation of a real number?

• B
• hatem240600
In summary, the conversation discusses finding the integer of a real number using an algebraic formula without the use of functions. Various suggestions are made, such as using IF statements or starting with arctan(tan(x)) and shifting it. The definition of "algebraic" is also questioned.

#### hatem240600

Is there a way to find the integer of a real number? Of course without using the [x] function. What I am looking for here is an algebraic formula.

You want an algorithm for a function without allowing the use of functions, right ?

(by the way, in many computer languages a = b does tthe trick if a is an integer and b a real )

Last edited by a moderator:
jedishrfu
You can get pretty close by starting with arctan(tan(x)). This gives you a sawtooth which you can shift, scale and subtract from f(x)=x. It's just those pesky points where tan x is undefined that get you.

Will you allow arctan2 as part of an algebraic formula?

To get answers that you want, you will note that the posters so far have asked how you define algebraic. These answers are reasonable. Please provide a solid definition. We cannot leave the thread open, if you continue to have the people who are helping you forced to guess. Thanks.

YoungPhysicist, jedishrfu and BvU
Since the OP has come back to the site and ignored the request for question improvement, this thread is closed. Thanks to the two posters who gave it a good try.

YoungPhysicist, BvU and berkeman

## 1. Can a real number be represented as an integer?

Yes, a real number can be represented as an integer if the number is a whole number without any decimal or fractional parts.

## 2. How can I convert a real number to its integer representation?

To convert a real number to its integer representation, you can use the floor or ceiling function depending on whether you want to round down or up to the nearest integer.

## 3. Is the integer representation of a real number always accurate?

No, the integer representation of a real number may not always be accurate as it involves rounding. This can lead to a loss of precision in the number.

## 4. Can all real numbers be represented as integers?

No, not all real numbers can be represented as integers. Some real numbers, such as irrational numbers like pi or square root of 2, have infinite decimal places and cannot be represented as a finite integer.

## 5. Are there any limitations to finding the integer representation of a real number?

Yes, there are limitations to finding the integer representation of a real number, such as the loss of precision mentioned earlier and the fact that some real numbers cannot be represented as integers. Additionally, the size of the integer may also be limited by the computer's memory capacity.