This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-05-26 20:28:37

Dazachi
Retired Community Moderator
Registered: 2009-09-12
Posts: 1000+

Abs

I don't understand abs. What does it do?


Dazachi, Retired Community Moderator
May also know me as OJACheung.

Offline

 

#2 2010-05-26 20:30:39

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: Abs

Dazachi wrote:

I don't understand abs. What does it do?

It returns the absolute value.

abs(20.456)=20.456
abs(-6437.78)=6437.78

It's basicly removing the minus sign

Last edited by ThePCKid (2010-05-26 20:30:56)

Offline

 

#3 2010-05-26 20:32:11

Dazachi
Retired Community Moderator
Registered: 2009-09-12
Posts: 1000+

Re: Abs

ThePCKid wrote:

Dazachi wrote:

I don't understand abs. What does it do?

It returns the absolute value.

abs(20.456)=20.456
abs(-6437.78)=6437.78

It's basicly removing the minus sign

Hmm, ok. Thanks.


Dazachi, Retired Community Moderator
May also know me as OJACheung.

Offline

 

#4 2010-05-27 01:46:51

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Abs

Think of it as the distance to zero.  wink


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#5 2010-05-27 01:50:44

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: Abs

This is what the parent function graph looks like.

http://img.sparknotes.com/figures/1/15debaf09555bfc7c688d9ee8ae574bc/abs_graph.gif

When the answer < 0, it takes the opposite and returns that answer.
When the answer ≥ 0, it reports that answer.

Last edited by Vista4563 (2010-05-27 01:53:07)


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#6 2010-05-27 01:58:36

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Abs

I think "distance to zero" is simpler, though...  tongue


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#7 2010-05-27 02:03:05

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: Abs

I only wanted to add a visual aid for the visual learners...  tongue


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#8 2010-05-27 17:17:38

iCode-747
Scratcher
Registered: 2009-11-21
Posts: 1000+

Re: Abs

I use it in physics sims to make balls bounce. It flips the negative YVel.

http://img193.imageshack.us/img193/1448/sfghfd.gif


-End Transmission-

Offline

 

Board footer