Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: joao9856 on January 25, 2013, 04:18:48 pm
-
How can i from a number like 9.57 turn into 9?
if you didn't understand please say it.
-
The nspire has an 'int()' command for that. But you have to be careful int(9.57) gives back 9. WITH the dot, which can be problematic with comparing sometimes.
-
so thats is all what int() command does?(really a question since i never heard of it)
-
Yes, int() cuts off any decimals (converts it to an Integer). But the nspire literally cuts off the decimals and leaves the dot (.) in place.
-
Yes, int() cuts off any decimals (converts it to an Integer).
More importantly it rounds down
int(9.57)=9
int(-9.57)=-10
But the nspire literally cuts off the decimals and leaves the dot (.) in place.
Well if you were worried about that you could give int(9.57)->approxFraction(5.E-14)
-
Yes, int() cuts off any decimals (converts it to an Integer).
More importantly it rounds down
int(9.57)=9
int(-9.57)=-10
But the nspire literally cuts off the decimals and leaves the dot (.) in place.
Well if you were worried about that you could give int(9.57)->approxFraction(5.E-14)
That's very useful! And yeah, the rounding down is also important indeed.
-
If you want it to round mathematically instead of always down, use round(integer, digits).
round(-9.4,0)=-9
-
You can also use exact() (exact(9.) => 9 ). Also, 9=9. return true.
-
that exact() would be good but i'm currently using a non CAS version, thanks anyway
-
a comand that does the rounding down without the dot is ipart() just found it today!
-
ipart() returns the integer part of the argument
And I think it keeps the dot, because ipart(9.57) returns 9.
-
indeed it does leave the dot...
I'm having to much calc