Skip to content

fix: use slant side instead of height in parallelogram_perimeter#3182

Open
https-hari wants to merge 2 commits into
TheAlgorithms:masterfrom
https-hari:fix/parallelogram-perimeter-side-not-height
Open

fix: use slant side instead of height in parallelogram_perimeter#3182
https-hari wants to merge 2 commits into
TheAlgorithms:masterfrom
https-hari:fix/parallelogram-perimeter-side-not-height

Conversation

@https-hari

Copy link
Copy Markdown

Fixes #3174

Problem

parallelogram_perimeter(base, height) used the perpendicular height as
the second argument. The perimeter of a parallelogram is 2*(base + side)
where side is the slant side length — NOT the perpendicular height.

Fix

  • Renamed parameter from height to side in function signature
  • Updated Doxygen @param doc accordingly
  • Updated test (7th) to use int_side variable and correct comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

math/perimeter: parallelogram_perimeter uses perpendicular height instead of the side length (wrong perimeter)

1 participant