Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2011-12-27 04:00:31

model
Member
Registered: 2011-08-10
Posts: 142

slow and fast speed calculation

Hy  all ,

Since i am trying to detect slow and  fast motion of  my moving object . ,Conceptually , When i move  slow  then my current and previous motion almost about  near ,., not much difference  ... so probably less difference and speed  would be low . .

but if i move fast  then more distance  will cover at the same  time . so speed  will be more .

But some time i get distance  some thing like

get this value

Distance : 1.1219e+006
speed :47.1996
Distance : 1.1219e+006
speed :47.1996
Distance : 1.1219e+006
speed :47.1996
Distance : 1.1219e+006
speed :47.1996
Distance : 1.1219e+006
speed :47.1996

i do't understand this reason .

any one could guide me please thanks


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

#2 2011-12-27 05:41:15

Bob
Administrator
Registered: 2010-06-20
Posts: 10,143

Re: slow and fast speed calculation

hi model

Distance : 1.1219e+006

Is this what is bothering you?

This is called standard index form.

It is used for very large or very small numbers.

Is that what you wanted?

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#3 2011-12-27 07:15:31

model
Member
Registered: 2011-08-10
Posts: 142

Re: slow and fast speed calculation

yes so  i think i should try to handle very large and very small numbers .  but any idea how  ?


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

#4 2011-12-27 11:54:12

Bob
Administrator
Registered: 2010-06-20
Posts: 10,143

Re: slow and fast speed calculation

What computer language?

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#5 2011-12-27 13:32:21

model
Member
Registered: 2011-08-10
Posts: 142

Re: slow and fast speed calculation

I  am using c++


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

#6 2011-12-27 20:42:32

Bob
Administrator
Registered: 2010-06-20
Posts: 10,143

Re: slow and fast speed calculation

hi model,

C++ will give you floating decimal forms for numbers unless you specify otherwise.

A short integer will only go up to 32,767,

and a long integer to 2,147,483,647.

But as you want to do calculations involving distance / speed / time the floating form is probably best.

So you probably don't need to do anything in order to handle very large or very small numbers.

Do you want to output numbers to the user in a more readable form?

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#7 2011-12-28 22:01:27

model
Member
Registered: 2011-08-10
Posts: 142

Re: slow and fast speed calculation

yes .. I  want output in more readable or  understandable  form for user .


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

#8 2011-12-29 00:15:34

model
Member
Registered: 2011-08-10
Posts: 142

Re: slow and fast speed calculation

since i am using double for speed and distance . and  this  output
Distance : 1.1219e+006
speed :47.1996 

is terrible or not  understandable specially for me .
so i want  the output that user should easy to understand . and also should work for my project requirement .


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

#9 2011-12-29 00:18:24

model
Member
Registered: 2011-08-10
Posts: 142

Re: slow and fast speed calculation

Hy Bob ,

if floating point i meant double is best to use then how  to get rid from  very  large and very small numbers  ???


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

#10 2011-12-30 06:54:53

Bob
Administrator
Registered: 2010-06-20
Posts: 10,143

Re: slow and fast speed calculation

hi model

I'm not familiar with the code for this.

Can you just do the calculations in 'double' then set a new integer variable equal to the answer and output this?

ELSE

Convert  1.1219e+006 to a 'string' , split it into '1.1219' then 'e' then '006'.

Then construct an integer by 1.1219 x 10^006

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#11 2011-12-30 21:16:32

model
Member
Registered: 2011-08-10
Posts: 142

Re: slow and fast speed calculation

ah you meant do calculation in double but show  your  ans in int form by  casting double to int .

I see.. ok Thanks Bob . smile


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

Board footer

Powered by FluxBB