Hi.

I've got a report where I'm making comparisons between 2 different
values.  It's possible for the percentage difference from one value to
the next to be less than or greater than the original number.

If value 2 is 20% greater than OR 20% less than value 1, I want to
highlight that row in a table that I created.


Any thoughts on how to write the correct if statement that would yield
this result?


So far I have diff = (value1 - value2) / value1

.5 = (10-5)/10 which is a 50% decrease between the 2 values

Since the percentage difference is greate than 20%, how can I test that
50% in an if statement to highlight this difference for review?

THANKS!
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to