| The United-TI Forum is Read-Only. | |
| 18 Oct 2009 01:51:44 pm by Newbie | ||||||
Thanks. Just so it doesn't sound confusing, I want it just using arithmetic. The way you quoted it, it seemed like I was asking for any way other than arithmetic. :biggrin: |
||||||
| 18 Oct 2009 01:55:19 pm by Builderboy2005 | ||
| well, if you are using a language that can cast to an integer, that might be a good way. Like, 7.333 would be cast to 7, and then its simple subtraction to get what you need. It does depend on the language thigh, what are you using? | ||
| 18 Oct 2009 02:06:39 pm by Newbie | ||
| PHP, but it would be nice to know something to just works across everything. | ||
| 18 Oct 2009 02:19:49 pm by bfr | ||
| Yeah, I was thinking what Builderboy2005 said. I think nearly every programming language should have some sort of floor/cast to integer method built-in. If it for some reason doesn't and you can only add, subtract, multiply, and divide, then you could get your result by calculating 7 mod 3 using only those operations, which equals 1, and then 1/3 is your result. | ||
| 18 Oct 2009 03:39:52 pm by Weregoose | ||
| Here's a funky way that probably wouldn't be very useful in your case: [font="times new roman"]1/2 – arctan(cot(π x))/π
Theoretically, though, this only works for positive numbers that are not integer multiples of 1/2. But if you have access to int(), floor(), mod(), round(), etc., there are many transformations that will net you fpart(). |
||
| 18 Oct 2009 04:48:12 pm by Newbie | ||||
haaaaa. :biggrin: Like you and many others said, I'm probably better off just using the built in functions. PHP has round and mod from what I know as well as others probably, but thanks for your help. Didn't realize it would be this complex. Well I guess I sorta did because of how long I was trying to figure out a way with no results. Thanks everybody. |
||||
| 18 Oct 2009 08:00:12 pm by GloryMXE7 | ||
| well ypu could transform the fraction to a mixed number and take only the fraction part
ex 7/3 = 2 1/3 1/3 = .333333 but your probably better of with the built in functions though |
||
| 18 Oct 2009 10:36:26 pm by vanchagreen | ||||
Going on Glory MXE7's post some pseudo code might be:
|
||||
| 19 Oct 2009 11:26:26 am by Newbie | ||
| Quick question off topic though:
If I have a php page say: home.php and I want it to say home.php?page=1 how would I get ?page=1 in the url the first time some visits the page? It's easy to have a link that someone can click and it does that, but what can be done the first time someone comes to the page to change the URL to say that? |
||
| 20 Oct 2009 01:37:42 am by cjgone | ||
| Redirect the page? |
||
| 21 Oct 2009 08:56:43 pm by FloppusMaximus | ||||
| If home.php is equivalent to home.php?page=1, why does it matter which URL you use?
As to the original question: you're really just asking how to implement the modulus operation. One way:
|
||||
| 02 Mar 2011 06:35:48 pm by Lego | ||
| don't know what php does if you write an float into an int, but in c you can do it like that
int x; float y=7,33333; x=y; now x = 7 then just to y=y-x so you geht y=0,33333 Edit: Sorry i haven't read the posted date |
||
| The United TI Forum is Read-Only. | |
[Switch to Desktop view]
© Copyright 2000-2013 Cemetech & Kerm Martian :: Mobile Design by Alex "comicIDIOT" Glanville
Problems? Issues? Or Suggestions? There's a thread for that!
© Copyright 2000-2013 Cemetech & Kerm Martian :: Mobile Design by Alex "comicIDIOT" Glanville
Problems? Issues? Or Suggestions? There's a thread for that!
