encyclopegia.org

Numerical tower

In Scheme, the numerical tower is a set of data types that represent numbers and a logic for their hierarchical organisation.[src] Each type in the tower conceptually "sits on" a more fundamental type, so an integer is a rational number and a number, but the converse is not necessarily true, i.e.[src] not every number is an integer.[src] This asymmetry implies that a language can safely allow implicit coercions of numerical types—without creating semantic problems—in only one direction: coercing an integer to a rational loses no information and will never influence the value returned by a function, but to coerce most reals to an integer would alter any relevant computation (e.g., the real 1/3 does not equal any integer) and is thus impermissible.[src]

In Scheme, the numerical tower is a set of data types that represent numbers and a logic for their hierarchical organisation.[src] Each type in the tower conceptually "sits on" a more fundamental type, so an integer is a rational number and a number, but the converse is not necessarily true, i.e.[src] not every number is an integer.[src] This asymmetry implies that a language can safely allow implicit coercions of numerical types—without creating semantic problems—in only one direction: coercing an integer to a rational loses no information and will never influence the value returned by a function, but to coerce most reals to an integer would alter any relevant computation (e.g., the real 1/3 does not equal any integer) and is thus impermissible.[src] 1 -2 +3 ⇒ 1 ⇒ -2 ⇒ 3 1/3 ⇒ 1/3 72/6+8/3i ⇒ 12+8/3i ; coercion: canonical form (+ 3+2i 2-2i) ⇒ 5 ; coercion: canonical form (- 3-62/32i 1+inf.0i) ⇒ 2-inf.0i ; coercion: infinite cardinality (> 3+0/2i 3) ⇒ #f ; coercion: 3 ≯ 3 While in the following Python examples we see: 1; -2; +3 ⇒ 1 ⇒ -2 ⇒ 3 1/3 ⇒ 0.3333333333333333 inf = float('inf') # infinity not first-class from fractions import Fraction x = Fraction(1, 3) y = Fraction(2, 3) x + y ⇒ Fraction(1, 1) # no coercion (3+2j) ⇒ (3+2j) complex(x, inf) ⇒ (0.3333333333333333+infj) # coercion: equality violated a = 1/3 b = Fraction(1, 3) caz = complex(a, 0) cbz = complex(b, 0) a == b ⇒ False caz == cbz ⇒ True # proof of equality violation complex(x + y, -inf) ⇒ (1-infj) # coercion: equality preserved (3+0j) > 3 ⇒ Traceback (most recent call last): ⇒ File " ", line 1, in # no coercion: type error ⇒ TypeError: '>' not supported between instances of 'complex' and 'int' In the Python examples, we can see that numerical issues freely arise with an inconsistent application of the semantics of its type coercion.[src] While 1 / 3 in Python is treated as a call to divide 1 by 3, yielding a float, the inclusion of rationals inside a complex number, though clearly permissible, implicitly coerces them from rationals into floats or ints, even in cases where this is incorrect.[src] Smalltalk is another programming language that follows this model, but it has ArithmeticValue and Magnitude as superclasses of Number.[src] The Numerical Tower of Scheme was inspired by the hierarchy of numeric types in Common Lisp.[src] Number / \ Real Complex / \ Rational Float / \ Integer Ratio ==References==[src]

13 sentences · 13 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Numerical tower." encyclopegia.org, 2024, https://encyclopegia.org/wiki/numerical-tower. Accessed 29 November 2026.

Chicago

"Numerical tower." encyclopegia.org. Accessed November 29, 2026. https://encyclopegia.org/wiki/numerical-tower.

APA

encyclopegia.org. (2024). Numerical tower. Retrieved November 29, 2026, from https://encyclopegia.org/wiki/numerical-tower

Accessed November 29, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

tower

stub · references available

Princess Tower

stub · references available

Zenon Tower

stub · references available

Luitpold tower

stub · references available

Tower Prep

stub · references available

Tower City

stub · references available

Governor Phillip Tower

stub · references available

Naruto Shippuden the Movie: The Lost Tower

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1256285939 · 0.5 · snapshot enwiki-001256285939

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.