René's URL Explorer Experiment


Title: Arithmetic that differs from Python: % with negatives, ** grouping, round halves, bool as int, e · Issue #224 · vpython/glowscript · GitHub

Open Graph Title: Arithmetic that differs from Python: % with negatives, ** grouping, round halves, bool as int, e · Issue #224 · vpython/glowscript

X Title: Arithmetic that differs from Python: % with negatives, ** grouping, round halves, bool as int, e · Issue #224 · vpython/glowscript

Description: While fixing #170 I ran a 122-expression arithmetic program through Web VPython 3.2 and compared every result with CPython. 107 match. The rest differ. All of these differences are older than #170: the release before it has every one of ...

Open Graph Description: While fixing #170 I ran a 122-expression arithmetic program through Web VPython 3.2 and compared every result with CPython. 107 match. The rest differ. All of these differences are older than #170:...

X Description: While fixing #170 I ran a 122-expression arithmetic program through Web VPython 3.2 and compared every result with CPython. 107 match. The rest differ. All of these differences are older than #170:...

Opengraph URL: https://github.com/vpython/glowscript/issues/224

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Arithmetic that differs from Python: % with negatives, ** grouping, round halves, bool as int, e","articleBody":"While fixing #170 I ran a 122-expression arithmetic program through Web VPython 3.2 and compared every result with CPython. 107 match. The rest differ. All of these differences are older than #170: the release before it has every one of them.\n\n| Expression | Web VPython | Python | Cause |\n|---|---|---|---|\n| `7 % -3` | 1 | -2 | `%` is JavaScript's remainder, which takes the sign of the left operand. Python's takes the sign of the right one. |\n| `-7 % 3` | -1 | 2 | same |\n| `-7.5 % 2` | -1.5 | 0.5 | same |\n| `a = 7; a %= -3` | 1 | -2 | same |\n| `2**3**2` | 64 | 512 | `**` groups left to right (RapydScript emits `Math.pow(Math.pow(2, 3), 2)`). Python groups it right to left. |\n| `2**-1**2` | 0.25 | 0.5 | same |\n| `round(2.5)`, `round(-2.5)` | 3, -3 | 2, -2 | Halves round away from zero. Python rounds them to the even neighbour. |\n| `int(True)`, `True + 1` | error | 1, 2 | Booleans aren't treated as the integers 0 and 1. |\n| `log(e)` | error | 1 | `e` isn't defined (`pi` is). |\n| `a **= 2` | compile error | | \"Unexpected token: operator «=»\" |\n\nThe division-by-a-negative cases from #170, true and floor division, chained comparisons, `abs`/`min`/`max`/`sum`/`pow`/`sqrt`/`divmod`, `range` with negative steps, the trig and log functions, and integers up to 2\\*\\*52 all match Python.\n\nI also found a regression introduced by #170. Fixed with a test in #225. Before #170, the `\"-\" → \"-1*\"` rewrite hid a RapydScript bug: it printed `- -x` as `--x`, which in JavaScript is a decrement (wrong answer, and `x` changes). `- -3` didn't compile at all.\n\nRelated: #217 (refreshing the embedded RapydScript). I haven't checked which of these upstream RapydScript-NG has fixed; the `**` grouping is still the same at upstream `3e69ba8`.\n\nThe Trinket deploy suite pins these as known differences (PICUP-Physics/trinket-oss#369, `vpython-arithmetic.spec.js`), so a fix here will show up there.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n","author":{"url":"https://github.com/sspickle","@type":"Person","name":"sspickle"},"datePublished":"2026-11-03T09:18:08Z","url":"https://github.com/vpython/glowscript/issues/224"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c052ecef-e9bd-4446-18f9-5098f4b19616
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEE30:2642C6:350F55:4A76B1:6B006E90
html-safe-nonceb1be046c096db116671508e56bfb0c455a78e8b78c569eb812ea81b208ef2d2a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTMwOjI2NDJDNjozNTBGNTU6NEE3NkIxOjZCMDA2RTkwIiwidmlzaXRvcl9pZCI6IjQ3NTQ4NTYyNjI5MzA1NTEyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacff938e96b490d5f3debb5f097daa6e3b7e1a1e5d268ba2143ddc111b7c1e6c92
hovercard-subject-tagissue:6179654635
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/vpython/glowscript/224/issue_layout
twitter:imagehttps://opengraph.githubassets.com/24b7e2ca5f46cf40d418e67b8d9e909c9dd34287b461f8e1befd045702995b2d/vpython/glowscript/issues/224
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/24b7e2ca5f46cf40d418e67b8d9e909c9dd34287b461f8e1befd045702995b2d/vpython/glowscript/issues/224
og:image:altWhile fixing #170 I ran a 122-expression arithmetic program through Web VPython 3.2 and compared every result with CPython. 107 match. The rest differ. All of these differences are older than #170:...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesspickle
hostnamegithub.com
expected-hostnamegithub.com
None6527e91c60c0b29d16606ff32ac5df8ecdc37a2a62205ea057a14d7762c870fa
turbo-cache-controlno-preview
go-importgithub.com/vpython/glowscript git https://github.com/vpython/glowscript.git
octolytics-dimension-user_id1280757
octolytics-dimension-user_loginvpython
octolytics-dimension-repository_id187905631
octolytics-dimension-repository_nwovpython/glowscript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id187905631
octolytics-dimension-repository_network_root_nwovpython/glowscript
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
release46f1cd2ae3cd8ae1a81019b5d619742e76f13bbd
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/vpython/glowscript/issues/224#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fvpython%2Fglowscript%2Fissues%2F224
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%2Fvpython%2Fglowscript%2Fissues%2F224
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=vpython%2Fglowscript
Reloadhttps://github.com/vpython/glowscript/issues/224
Reloadhttps://github.com/vpython/glowscript/issues/224
Reloadhttps://github.com/vpython/glowscript/issues/224
vpythonhttps://github.com/vpython
glowscripthttps://github.com/vpython/glowscript
Codehttps://github.com/vpython/glowscript
Issues9 (9)https://github.com/vpython/glowscript/issues
Pull requests2 (2)https://github.com/vpython/glowscript/pulls
Actionshttps://github.com/vpython/glowscript/actions
Projectshttps://github.com/vpython/glowscript/projects
Security and qualityhttps://github.com/vpython/glowscript/security
Insightshttps://github.com/vpython/glowscript/insights
https://github.com/vpython/glowscript
New issuehttps://github.com/login?return_to=https://github.com/vpython/glowscript/issues/224
New issuehttps://github.com/login?return_to=https://github.com/vpython/glowscript/issues/224
Arithmetic that differs from Python: % with negatives, ** grouping, round halves, bool as int, ehttps://github.com/vpython/glowscript/issues/224#top
https://github.com/sspickle
sspicklehttps://github.com/sspickle
on Nov 3, 2026https://github.com/vpython/glowscript/issues/224#issue-6179654635
#170https://github.com/vpython/glowscript/issues/170
#170https://github.com/vpython/glowscript/issues/170
#170https://github.com/vpython/glowscript/issues/170
#170https://github.com/vpython/glowscript/issues/170
#225https://github.com/vpython/glowscript/pull/225
#170https://github.com/vpython/glowscript/issues/170
#217https://github.com/vpython/glowscript/issues/217
PICUP-Physics/trinket-oss#369https://github.com/PICUP-Physics/trinket-oss/pull/369
Claude Codehttps://claude.com/claude-code
sspicklehttps://github.com/sspickle
on Nov 3, 2026https://github.com/vpython/glowscript/issues/224#event-35008127766
test: check 112 Web VPython expressions against CPythonhttps://github.com/MIAuthors/trinket-oss/commit/55575f98dfc97b02169909fbdac57e271a2f37cb
55575f9https://github.com/MIAuthors/trinket-oss/commit/55575f98dfc97b02169909fbdac57e271a2f37cb
https://github.com/sspickle
sspicklehttps://github.com/sspickle
on Nov 3, 2026https://github.com/vpython/glowscript/issues/224#issuecomment-6604286067
#225https://github.com/vpython/glowscript/pull/225
#225https://github.com/vpython/glowscript/pull/225
#223https://github.com/vpython/glowscript/pull/223
#223https://github.com/vpython/glowscript/pull/223
#225https://github.com/vpython/glowscript/pull/225
Claude Codehttps://claude.com/claude-code
sspicklehttps://github.com/sspickle
on Nov 3, 2026https://github.com/vpython/glowscript/issues/224#event-35065031311
fix: parse ** tighter than a unary operator on its left, as Python doeshttps://github.com/vpython/glowscript/commit/61d0edf281417289e5a257ede735d40328be9054
61d0edfhttps://github.com/vpython/glowscript/commit/61d0edf281417289e5a257ede735d40328be9054
fix: "- -x" and unary minus with ** compile as in Python; rebuild the…https://github.com/vpython/glowscript/commit/f9bf597f58a48003b2a54cb17d70acfabdb37e8e
f9bf597https://github.com/vpython/glowscript/commit/f9bf597f58a48003b2a54cb17d70acfabdb37e8e
Sign up for freehttps://github.com/signup?return_to=https://github.com/vpython/glowscript/issues/224
Sign in to commenthttps://github.com/login?return_to=https://github.com/vpython/glowscript/issues/224
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.