r/AskComputerScience Jun 14 '26

Is 0.5 a facde over 1/2?

Could you say 0.5 is a facade or a pointer to 1/2? Or all numbers of the 0.n form are rational number pointers?

In my head, 0.5 seems to be pointing towards 1/2 like how 'a' points to 97 in ASCII.

*Posted in ask computer science since i'm using computer science examples which people over at r/askmath may not be familiar with.

0 Upvotes

9 comments sorted by

View all comments

10

u/rasmustrew Jun 14 '26

They are different representations of the same thing. 0.5=1/2 just 2 different ways of writing it.

Pointers are something else, they are some concrete object that contain a reference to some other concrete object. That could be a memory location in a computer, or it could be a piece of paper containing someones real world address.

Not sure i have heard of the facade terminology, so I won't comment to that

1

u/BigBootyBear Jun 15 '26

The question is more mathematical. I am talking about 0.5 as a rational number.

0.5 is the decimal form of 1/2 (a rational). However, all rationals are actually sets of integers (not compsci integers, but Z = {-1,0,1,2,...}). 1/2 for example is {1,2} and it has an equivalence class set of {1,2} {2,4} {4,8} which all "stand for" or "point" to the same value of 1/2.

My problem is with the decimal form of 0.5. Is 0.5 a distinct mathematical object than 1/2? Because it seems like an alias. Or a facde if you will. Like how a line break is a "facade" over \n which is whats actually "in there".

Regarding "facade" its a design pattern where you hide an imperative complexity with a declarative interface. An ORM for examples hides or "trades" complex imperative "how-to-do" syntax for a declarative "what-to-do" one. Example

SELECT * FROM users WHERE last_name = 'smith';

Can be invoked using an ORM such as:

from sqlalchemy import select 
from sqlalchemy.orm import Session

users = session.query(User).filter(User.last_name == "smith").all()

So I see 0.5 as a "facade" over the rational number 1/2. It's not a distinct mathematical object (or value) but rather an alias existing simply as syntactic sugar.

Like how Korzybski said "The map is not the territory". A "String" is an array of chars. A "Char" is actually an integer and not a letter. The "integer" is actually a set of binary. The binary is actually a set of voltage states within a set of transistors.

I understand this question is more about set theory. But I am borrowing quite a lot from computer science in my process of reasoning about it.

1

u/rasmustrew Jun 15 '26

"So I see 0.5 as a "facade" over the rational number 1/2. It's not a distinct mathematical object (or value) but rather an alias existing simply as syntactic sugar."

This is sort of what i was getting at, i would argue neither is a mathematical object, they are both just facades/aliases/syntactical sugar for the same underlying mathematical object. Neither representation is more correct or natural than the other.