Author Topic: Any Reason This Shouldn't Work?  (Read 8275 times)

0 Members and 1 Guest are viewing this topic.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Any Reason This Shouldn't Work?
« Reply #15 on: October 06, 2010, 06:34:47 pm »
round() is the better solution, but i just wanted to see if that was what was causing the error :) round() does what you want, iPart() doesnt quite, but it at least takes out the error.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Any Reason This Shouldn't Work?
« Reply #16 on: October 06, 2010, 06:49:29 pm »
Why would round( be better in this case?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Any Reason This Shouldn't Work?
« Reply #17 on: October 06, 2010, 06:51:05 pm »
Because if you do some math and get a decimal that is 7.9999999999999999, iPart() will give you 7, and round() will give 8.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Any Reason This Shouldn't Work?
« Reply #18 on: October 06, 2010, 06:55:58 pm »
Well since the numbers are "whole" (or supposed to be and appear to be) there isn't a place where you'll get that. I have round( earlier in a the program though to take care of that issue you said though. I mean this whole issue has been about this number is supposed to be whole but apparently has a decimal place that doesn't show or something.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Any Reason This Shouldn't Work?
« Reply #19 on: October 06, 2010, 06:58:26 pm »
round( should always take care of it, though. Could you maybe post the code? There might be something else interfering with it.




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Any Reason This Shouldn't Work?
« Reply #20 on: October 06, 2010, 07:03:43 pm »
round( should always take care of it, though. Could you maybe post the code? There might be something else interfering with it.

That's what I assumed but ya. Hold on.

Edit:
The code that was giving the error was:

Code: [Select]
7fPart((round(7fPart(Z/7),0)+28(M>2)+31sum(M>{1,3,5,7,8,10})+(M≥2)iPart(Z/4)+30sum(M>{4,6,9,11}))/7→U
All I did to fix that was put a iPart( in the front of that and it works, though it shouldn't be necessary (in theory).
« Last Edit: October 06, 2010, 07:08:44 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Any Reason This Shouldn't Work?
« Reply #21 on: October 06, 2010, 07:04:34 pm »
Yeah the code could really help in this case, seems likes a specific instruction that is adding in the decimal

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Any Reason This Shouldn't Work?
« Reply #22 on: October 06, 2010, 07:16:17 pm »
I posted the code in that previous post. It seems I did it before I saw you posted.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Any Reason This Shouldn't Work?
« Reply #23 on: October 06, 2010, 07:18:56 pm »
I'd assume it's the first 7fPart(. The round( doesn't take care of that.

EDIT: Just move the round( to the beginning (and take care of the syntax, of course).

EDIT2: In other words, do this:
Code: (TI-BASIC) [Select]
round(7fPart((7fPart(Z/7)+28(M>2)+31sum(M>{1,3,5,7,8,10})+(M≥2)iPart(Z/4)+30sum(M>{4,6,9,11}))/7),0)→U

EDIT3: I haven't tested it, though.
« Last Edit: October 06, 2010, 07:22:21 pm by Deep Thought »




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Any Reason This Shouldn't Work?
« Reply #24 on: October 06, 2010, 07:22:05 pm »
Well it shouldn't matter because those just return the moduli of the equations. So they should be whole numbers.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Any Reason This Shouldn't Work?
« Reply #25 on: October 06, 2010, 07:23:21 pm »
Yeah, but the 7fPart( could produce another rounding error. That's why you need round(, anyway.

Not sure if I understand you correctly...




Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Any Reason This Shouldn't Work?
« Reply #26 on: October 06, 2010, 07:25:18 pm »
Try this code:
0->A
0->B
1/3->C
Repeat getKey
A+C->A
B+1->B
End
Disp int(B/3),int(A
« Last Edit: October 06, 2010, 07:44:26 pm by ztrumpet »

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Any Reason This Shouldn't Work?
« Reply #27 on: October 06, 2010, 07:28:08 pm »
Well it works now with doing what you said so it's fine. But if I understand modulus correctly it has to be a whole number (I believe) and all MfPart(A/M does is return the moduli where M is the modulus and A is the number that you're getting the moduli from (ya, some of that grammar is probably incorrect but that's because I don't know much about what is what when it comes to modulus and such). So it should be a whole number. But it works now so no worries. Thanks guys :)

@Z
What is that code supposed to do and who is supposed to try it?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Any Reason This Shouldn't Work?
« Reply #28 on: October 06, 2010, 07:31:10 pm »
Well, just for clarification, MfPart(A/M isn't a system routine to find the modulus. It does exactly what you see there: it divides A by M, and takes the fPart, which is some random decimal. Multiplying it by M doesn't always produce a whole number because of the calc's stupid rounding errors. It's like that trick where

Code: (TI-BASIC) [Select]
Disp 1+E99-E99

produces a 0.




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Any Reason This Shouldn't Work?
« Reply #29 on: October 06, 2010, 07:34:48 pm »
Ya, I know. But it's supposed to. But ya, it was just pissing me off because it wasn't showing there was a decimal place at all when I checked the value. So I had no idea what was going on. But thanks.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)