रेंडरिंगhi

Translation status: हिन्दी reader-locale proof. Code fences render through the hi pipeline; prose is canonical Latin.

Numeric value equality after promotion join — not fuzzy float.

Syntax: <expression> ≈ <expression> | <expression> ≉ <expression>

Category#

comparison

Examples#

radix/corpus/operatores/numeric-value-eq.fab (canonical · operator)#

Numeric value equality after promotion join — not fuzzy float.

# =============================================================================
# ≈ — Numeric value equality after promotion join — not fuzzy float.
# =============================================================================
#
# What this teaches:
#   • Value equality — `≈` promotes numeric types to a common width before comparing.
#   • Exact comparison — Unlike `≡`, `≈` works across numeric widths (u8 vs i64), but still exact.
#
# Common mistakes:
#   • Expecting ≈ to be fuzzy or approximate — it is exact value equality after promotion.
#
# See also: ≡, ≠, ↦, adfirma
# =============================================================================

# operatores/numeric-value-eq — ≈ ≉
#
# WHY: ≡ requires identical types; ≈ promotes numerics then exact-compares.
# 42.145 ≈ 42 must stay false (no hidden tolerance).

main {
    const int<u8> port  42 ∷ int<u8>
    const int count  42
    const _ same_width  port  count
    print same_width

    const _ int_float  1  1.0
    print int_float

    const _ not_fuzzy  42.145 ∷ float<f64>  42.0 ∷ float<f64>
    print not_fuzzy

    const _ differs  12
    print differs
}

Expected output:

verum
verum
falsum
verum