Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

LPF Donation via Stripe | LPF Donation - Other Methods

Links below open in new window

ArcticMyst Security by Avery

Looking for a special equation...

Joined
Feb 11, 2009
Messages
505
Points
0
I am looking for an equation into which you can plug a decimal number and your output will be the closest whole number.

Ex1. If my input is 3.49856, the output would be 3
Ex2. If my input is 10.6987, the output would be 11
Ex3. If my input is 0.3946, the output would be 0

And so on. Pretty much just an equation to round any number to the nearest whole number.

Thanks!

-Jakob
 





udanis

0
Joined
Aug 2, 2010
Messages
1,131
Points
48
I am looking for an equation into which you can plug a decimal number and your output will be the closest whole number.

Ex1. If my input is 3.49856, the output would be 3
Ex2. If my input is 10.6987, the output would be 11
Ex3. If my input is 0.3946, the output would be 0

And so on. Pretty much just an equation to round any number to the nearest whole number.

Thanks!

-Jakob

Like a physical equation?
This can be done easily with a few lines in most programming languages
 
Joined
Aug 6, 2010
Messages
382
Points
0
What's wrong with the "if it's greater than 5" rule?
Use that on any number .....................
 
Joined
Feb 11, 2009
Messages
505
Points
0
Like a physical equation?
This can be done easily with a few lines in most programming languages

A mathematical equation. Something that I could type into a graphing calculator.

What's wrong with the "if it's greater than 5" rule?
Use that on any number .....................

This I know, but I'm asking for an equation that can round decimals mathematically :) let's just say machines don't think like us humans do.

-Jakob
 

udanis

0
Joined
Aug 2, 2010
Messages
1,131
Points
48
Something that I could type into a graphing calculator.


Oh that's easy why didn't you say so?

I have have ti-89 so there are the instructions for that model:
Mode
Display Digits
<right arrow>
<1>
<enter>



Then that automatically rounds to the nearest whole number.


Not sure if this is exactly what your looking for.

twhite828 you beat me too it.
 
Last edited:
Joined
Feb 11, 2009
Messages
505
Points
0
http://www.lmgtfy.com/?q=TI-83+round+to+nearest+int
Let me google that for you

What assignment are we doing for you?

-Trevor

No assignment, just a personal math problem that I've been pondering. I'm in calculus, way above rounding numbers... And I tried googling this and yahoo-answering this before I brought it to LPF.

Oh that's easy why didn't you say so?

I have have ti-89 so there are the instructions for that model:
Mode
Display Digits
<right arrow>
<1>
<enter>

Then that automatically rounds to the nearest whole number.


Not sure if this is exactly what your looking for

Thanks for the help, not quite what I was looking for though. I already knew about the float function, but there has to be SOME equation that is in the calculator to make it round from any decimal-number to a whole number. And this equation is what I'm trying to find.

-Jakob
 
Joined
Aug 6, 2010
Messages
382
Points
0
Really.................?
Ok.............
If Z = A.X and X < 5 then Z equals A.0 else Z = A + 1

There all in one line. Surely you can apply this to other decimals............
Hope you get an "A".

Edit: Something tells me calculus isn't going well.......:crackup:
 
Last edited:

Trevor

0
Joined
Jul 17, 2009
Messages
4,386
Points
113
No assignment, just a personal math problem that I've been pondering. I'm in calculus, way above rounding numbers... And I tried googling this and yahoo-answering this before I brought it to LPF.

Heh, high school calculus. :crackup:

Rounding is a logic problem, not a mathematical one. I think you're barking up the wrong tree.

-Trevor
 
Joined
Feb 11, 2009
Messages
505
Points
0
Heh, high school calculus. :crackup:

Rounding is a logic problem, not a mathematical one. I think you're barking up the wrong tree.

-Trevor

Nopeeeee college calculus at my local college! I don't know what you mean by barking up the wrong tree, I'm just trying to find a mathematical equation to round a number. I've done boolean algebra, would that be considered logic? To my knowledge, I cannot put boolean algebra into a normal calculator .There has to be some way to approach this problem to come up with a normal mathematical equation, be it using derivatives, integrals, powers, etc...

Really.................?
Ok.............
If Z = A.X and X < 5 then Z equals A.0 else Z = A + 1

There all in one line. Surely you can apply this to other decimals............
Hope you get an "A".

Edit: Something tells me calculus isn't going well.......:crackup:

C'mon guys this isn't grade related. I'm doing this for my own fun, not to get an "A" in my stupid calculus class. Right now we're covering Bernoulli's rule at the moment... nothing related to rounding numbers. And no right now I have a 79% C :p

-Jakob
 
Last edited:
D

Deleted member 8382

Guest
in java:

public int round ( double A){

if(A-|A| >= 0.5)
return |A|+1
else
return |A|

}

now, translate that into whatever the programming language your calculator is using to and there you go :)
 
D

Deleted member 8382

Guest
Oh, only maths!

I really can't think of anything, and I doubt there's one at all. But I think I know a way to abuse the calculator limitations to get this done: make the calculator loose them: Something like elevate to 99, then sqrt of the result. This will cause some decimals to get lost. Now use 9999999 ;)
 
Joined
Feb 11, 2009
Messages
505
Points
0
in java:

public int round ( double A){

if(A-|A| >= 0.5)
return |A|+1
else
return |A|

}

now, translate that into whatever the programming language your calculator is using to and there you go :)

Hehe thanks hallucynogen :) Look's like I will have to do some research on this one.

-Jakob
 

Trevor

0
Joined
Jul 17, 2009
Messages
4,386
Points
113
Nopeeeee college calculus at my local college! I don't know what you mean by barking up the wrong tree, I'm just trying to find a mathematical equation to round a number. I've done boolean algebra, would that be considered logic? To my knowledge, I cannot put boolean algebra into a normal calculator .There has to be some way to approach this problem to come up with a normal mathematical equation, be it using derivatives, integrals, powers, etc...

Cool story bro, I've taken calculus at the collegiate level too. More of it at a higher level. And I'm sure a whole lot people here have more and higher-level calculus under their belt than I do.

Perhaps your problem is that you focus on showboating rather than on your studies.

-Trevor
 
D

Deleted member 8382

Guest
if you don't want to use custom functions, then... can limits be used? can a piecewise function be used?
 
Joined
Aug 6, 2010
Messages
382
Points
0
I'm still wondering what is so hard abt the > than 5 rule.......
I'm no rocket scientist......I didn't fail math or programming languages either.
I'm at a quandary why to have it calculate the number when you can plug it in already rounded in your head or round the result in your head :thinking:

This is like the "duh" factor.............am I missing something?

Edit: Ok, do you realize the error factor when rounding via multiple times and used in an equation.......?
My last post here.......he's gotten responses in 4 formats.......enough is enough.
I may need to call the Troll Overlord in on this............lmao
 
Last edited:




Top