René's URL Explorer Experiment


Title: [BUG] Incorrect coordinate subtraction in DistanceFormula.euclideanDistance · Issue #7746 · TheAlgorithms/Java · GitHub

Open Graph Title: [BUG] Incorrect coordinate subtraction in DistanceFormula.euclideanDistance · Issue #7746 · TheAlgorithms/Java

X Title: [BUG] Incorrect coordinate subtraction in DistanceFormula.euclideanDistance · Issue #7746 · TheAlgorithms/Java

Description: Description In com.thealgorithms.maths.DistanceFormula.java, the method euclideanDistance(double x1, double y1, double x2, double y2) incorrectly subtracts x1 instead of y1 when computing the y-axis delta: public static double euclideanD...

Open Graph Description: Description In com.thealgorithms.maths.DistanceFormula.java, the method euclideanDistance(double x1, double y1, double x2, double y2) incorrectly subtracts x1 instead of y1 when computing the y-axi...

X Description: Description In com.thealgorithms.maths.DistanceFormula.java, the method euclideanDistance(double x1, double y1, double x2, double y2) incorrectly subtracts x1 instead of y1 when computing the y-axi...

Opengraph URL: https://github.com/TheAlgorithms/Java/issues/7746

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] Incorrect coordinate subtraction in DistanceFormula.euclideanDistance","articleBody":"### Description\nIn `com.thealgorithms.maths.DistanceFormula.java`, the method `euclideanDistance(double x1, double y1, double x2, double y2)` incorrectly subtracts `x1` instead of `y1` when computing the y-axis delta:\n\n```java\npublic static double euclideanDistance(double x1, double y1, double x2, double y2) {\n    double dX = Math.pow(x2 - x1, 2);\n    double dY = Math.pow(y2 - x1, 2); // \u003c--- Bug: x1 used instead of y1\n    return Math.sqrt(dX + dY);\n}\n```\n\nAs a result, it computes $\\sqrt{(x_2 - x_1)^2 + (y_2 - x_1)^2}$ instead of the Euclidean distance $\\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$.\n\nIn addition, `DistanceFormulaTest.java` hardcoded incorrect expected values that were produced by the buggy formula (for example, expecting $\\sqrt{50} \\approx 7.0710678$ instead of the true Euclidean distance $\\sqrt{58} \\approx 7.6157731$ for points `(1, 3)` and `(8, 0)`).\n\n### Steps to reproduce\n```java\n// Calculating Euclidean distance between (1, 3) and (8, 0)\n// dx = 8 - 1 = 7, dy = 0 - 3 = -3\n// Expected: sqrt(7^2 + (-3)^2) = sqrt(58) ≈ 7.615773105863909\ndouble distance = DistanceFormula.euclideanDistance(1, 3, 8, 0);\nSystem.out.println(distance); // Prints 7.0710678118654755 (which is sqrt(50))\n```\n\n### Expected behavior\n`DistanceFormula.euclideanDistance(x1, y1, x2, y2)` should subtract $y_1$ from $y_2$ (`Math.pow(y2 - y1, 2)`), correctly yielding $\\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$.","author":{"url":"https://github.com/spidervirus","@type":"Person","name":"spidervirus"},"datePublished":"2026-11-11T14:36:13Z","url":"https://github.com/TheAlgorithms/Java/issues/7746"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c2616503-6020-04f4-b342-860f54da90d7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD770:3166AC:4B6EE76:6413441:6AFA8A1B
html-safe-nonce2444624a4f677c8675804edbd606f593ac31575e60b28451ce7195def9669b1d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzcwOjMxNjZBQzo0QjZFRTc2OjY0MTM0NDE6NkFGQThBMUIiLCJ2aXNpdG9yX2lkIjoiODkyOTg3NzM3MjYyMjc2ODY2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd74b36a1b0a4ce0689ae0082bbf3a202b1be4807ea197bd8b7c0be786d5d0ee9
hovercard-subject-tagissue:6330710765
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TheAlgorithms/Java/7746/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3ee5faba1b9bcc51aa463276e8877f2716e79041ce7bf94c4103f0dd9e1f84a1/TheAlgorithms/Java/issues/7746
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3ee5faba1b9bcc51aa463276e8877f2716e79041ce7bf94c4103f0dd9e1f84a1/TheAlgorithms/Java/issues/7746
og:image:altDescription In com.thealgorithms.maths.DistanceFormula.java, the method euclideanDistance(double x1, double y1, double x2, double y2) incorrectly subtracts x1 instead of y1 when computing the y-axi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamespidervirus
hostnamegithub.com
expected-hostnamegithub.com
None612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7
turbo-cache-controlno-preview
go-importgithub.com/TheAlgorithms/Java git https://github.com/TheAlgorithms/Java.git
octolytics-dimension-user_id20487725
octolytics-dimension-user_loginTheAlgorithms
octolytics-dimension-repository_id63477660
octolytics-dimension-repository_nwoTheAlgorithms/Java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id63477660
octolytics-dimension-repository_network_root_nwoTheAlgorithms/Java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release072e34035c13c31543fba9f025cbbbda4210dae4
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/TheAlgorithms/Java/issues/7746#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FJava%2Fissues%2F7746
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FJava%2Fissues%2F7746
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=TheAlgorithms%2FJava
Reloadhttps://github.com/TheAlgorithms/Java/issues/7746
Reloadhttps://github.com/TheAlgorithms/Java/issues/7746
Reloadhttps://github.com/TheAlgorithms/Java/issues/7746
TheAlgorithmshttps://github.com/TheAlgorithms
Javahttps://github.com/TheAlgorithms/Java
Codehttps://github.com/TheAlgorithms/Java
Issues3 (3)https://github.com/TheAlgorithms/Java/issues
Pull requests17 (17)https://github.com/TheAlgorithms/Java/pulls
Actionshttps://github.com/TheAlgorithms/Java/actions
Security and qualityhttps://github.com/TheAlgorithms/Java/security
Insightshttps://github.com/TheAlgorithms/Java/pulse
https://github.com/TheAlgorithms/Java
New issuehttps://github.com/login?return_to=https://github.com/TheAlgorithms/Java/issues/7746
New issuehttps://github.com/login?return_to=https://github.com/TheAlgorithms/Java/issues/7746
#7747https://github.com/TheAlgorithms/Java/pull/7747
[BUG] Incorrect coordinate subtraction in DistanceFormula.euclideanDistancehttps://github.com/TheAlgorithms/Java/issues/7746#top
#7747https://github.com/TheAlgorithms/Java/pull/7747
https://github.com/spidervirus
spidervirushttps://github.com/spidervirus
on Nov 11, 2026https://github.com/TheAlgorithms/Java/issues/7746#issue-6330710765
DenizAltunkapanhttps://github.com/DenizAltunkapan
completedhttps://github.com/TheAlgorithms/Java/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#7747https://github.com/TheAlgorithms/Java/pull/7747
on Nov 12, 2026https://github.com/TheAlgorithms/Java/issues/7746#event-35894515484
Sign up for freehttps://github.com/signup?return_to=https://github.com/TheAlgorithms/Java/issues/7746
Sign in to commenthttps://github.com/login?return_to=https://github.com/TheAlgorithms/Java/issues/7746
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.