Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: joao9856 on January 25, 2013, 04:18:48 pm

Title: Another Question TI-Nspire basic
Post 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.
Title: Re: Another Question TI-Nspire basic
Post by: ElementCoder on January 25, 2013, 04:22:55 pm
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.
Title: Re: Another Question TI-Nspire basic
Post by: joao9856 on January 25, 2013, 04:24:17 pm
so thats is all what int() command does?(really a question since i never heard of it)
Title: Re: Another Question TI-Nspire basic
Post by: ElementCoder on January 25, 2013, 04:26:37 pm
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.
Title: Re: Another Question TI-Nspire basic
Post by: Rhombicuboctahedron on January 25, 2013, 04:28:02 pm
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)
Title: Re: Another Question TI-Nspire basic
Post by: ElementCoder on January 25, 2013, 04:32:12 pm
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.
Title: Re: Another Question TI-Nspire basic
Post by: lkj on January 25, 2013, 04:32:20 pm
If you want it to round mathematically instead of always down, use round(integer, digits).
round(-9.4,0)=-9
Title: Re: Another Question TI-Nspire basic
Post by: excale on January 25, 2013, 04:59:21 pm
You can also use exact() (exact(9.) => 9 ). Also, 9=9. return true.
Title: Re: Another Question TI-Nspire basic
Post by: joao9856 on January 26, 2013, 03:52:19 am
that exact() would be good but i'm currently using a non CAS version, thanks anyway
Title: Re: Another Question TI-Nspire basic
Post by: joao9856 on January 28, 2013, 09:49:49 am
a comand that does the rounding down without the dot is ipart() just found it today!
Title: Re: Another Question TI-Nspire basic
Post by: Rhombicuboctahedron on January 28, 2013, 03:55:36 pm
ipart() returns the integer part of the argument
And I think it keeps the dot, because ipart(9.57) returns 9.
Title: Re: Another Question TI-Nspire basic
Post by: joao9856 on January 28, 2013, 04:16:02 pm
indeed it does leave the dot...
I'm having to much calc