Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: Raylin on November 28, 2010, 03:56:48 pm
-
Is there any way to test this (1+int(abs(log()))) nested inside of an fPart?
For example, this:
1+int(abs(log(fPart(X
doesn't work.
This gets the # of digits in a number.
-
I'm confused... What do you mean by your first line?
Also, for a positive integer, 1+int(log(X works.
What is X?
-
so you want to get the number of digits in the fractional part of a number, am i right?
-
so you want to get the number of digits in the fractional part of a number, am i right?
Yes.
-
I don't think that's possible. You can tell how many leading 0's there are, but you can't tell how many significant figures there are.
log( won't distinguish much between .3333 and 1/3 x.x
-
i think you'd have to do the following, unless there's a neat math trick:
0->A
While fPart(X
10X->X
A+1->A
End
edit: and repeating decimals like 1/3 return 14 decimal places.
-
Yeah, that's what I meant. No neat math trick, to my knowledge.
Your code should work fine, though. :)
Edit: I mean, we could use a nice recursive function...
f(x) = {0 x=int(x)}
{1+f(x) x<>int(x)}
-
With Celtic III/DCS7, you could do:
length(det(1,X))-1-length(det(1,1+int(abs(log(X
;D
-
is that shorter than just using a loop though? it's probably faster granted
-
That's probably larger than it needs to be.
How about:
length(det(1,X))-inString(det(1,X),".