Author Topic: Another Question TI-Nspire basic  (Read 3612 times)

0 Members and 1 Guest are viewing this topic.

Offline joao9856

  • LV3 Member (Next: 100)
  • ***
  • Posts: 73
  • Rating: +3/-0
    • View Profile
Another Question TI-Nspire basic
« 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.

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #1 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.

Some people need a high five in the face... with a chair.
~EC

Offline joao9856

  • LV3 Member (Next: 100)
  • ***
  • Posts: 73
  • Rating: +3/-0
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #2 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)

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #3 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.

Some people need a high five in the face... with a chair.
~EC

Offline Rhombicuboctahedron

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 437
  • Rating: +41/-6
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #4 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)
« Last Edit: January 25, 2013, 04:29:30 pm by Rhombicuboctahedron »

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #5 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.

Some people need a high five in the face... with a chair.
~EC

Offline lkj

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +58/-1
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #6 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

Offline excale

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 103
  • Rating: +19/-1
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #7 on: January 25, 2013, 04:59:21 pm »
You can also use exact() (exact(9.) => 9 ). Also, 9=9. return true.
« Last Edit: January 25, 2013, 05:00:42 pm by excale »

Offline joao9856

  • LV3 Member (Next: 100)
  • ***
  • Posts: 73
  • Rating: +3/-0
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #8 on: January 26, 2013, 03:52:19 am »
that exact() would be good but i'm currently using a non CAS version, thanks anyway
« Last Edit: January 26, 2013, 03:52:51 am by joao9856 »

Offline joao9856

  • LV3 Member (Next: 100)
  • ***
  • Posts: 73
  • Rating: +3/-0
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #9 on: January 28, 2013, 09:49:49 am »
a comand that does the rounding down without the dot is ipart() just found it today!

Offline Rhombicuboctahedron

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 437
  • Rating: +41/-6
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #10 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.

Offline joao9856

  • LV3 Member (Next: 100)
  • ***
  • Posts: 73
  • Rating: +3/-0
    • View Profile
Re: Another Question TI-Nspire basic
« Reply #11 on: January 28, 2013, 04:16:02 pm »
indeed it does leave the dot...
I'm having to much calc