Are there real numbers in Java?

I am trying to rewrite this truebasic program over to java and most of it is working but sometimes the outcome(degrees) is one more than the original's outcome.

im assuming its a rounding error since it doesnt happen everytime. the only thing different is that im not using real numbers like in this line of the old code. is there a way to do that in Java?

IF temq >= 360! THEN temt = temt + 1!: temq = temq - 360

REM "! for real (as opposed to integer)

and also there was this line:

temp = t - INT(t): temq = 360 * temp + .5

to replace INT(t) ive been using Math.rint(t) and Math.round(t). neither seemed to be different in this case from what i noticed.

Re: Are there real numbers in Java?

Try using float or double (preferred). However, even the latter has its limitations associated with precision.

Regards,

Jim

Re: Are there real numbers in Java?

To be exact: Java uses the IEEE/459 number system; it is a number system that can represent a very funny subset of the set Q (rational numbers) which is a subset of the set R (real numbers); it's the best you can do on any digital computer with a finit amount of memory for a single number.

kind regards,

Jos