Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify docs on floats (and ints) #131

Open
PallHaraldsson opened this issue Oct 14, 2024 · 1 comment
Open

Clarify docs on floats (and ints) #131

PallHaraldsson opened this issue Oct 14, 2024 · 1 comment

Comments

@PallHaraldsson
Copy link

PallHaraldsson commented Oct 14, 2024

I see that you understandably inherit the limitations for Float64, from Erlang/OTP, i.e. Gleam and Erlang are not suitable for high-performance) numerical computing, e.g. no divide by zero exception.

I suppose you have those integer limits and sizes:
https://www.erlang.org/doc/system/memory.htm

On 64-bit architectures: -576460752303423489 < i < 576460752303423488 (60 bits).
Large integer At least 3 words.

Float [32-bit.. ] On 64-bit architectures: 3 words.

Do you use the smaller tagged 64/60-bit integers (or 3-word larger)? It's not a big limitation, though a speed-bump in either case, even more for 3-word ints or floats.

A way to clarify might be "60-bit ints" and/or link to that URL.

Is there a way to escape those limitations? You can compile to JavaScript, and does that mean executing in the browser only, or also elsewhere? I suppose you can just get the outputted JS (and run locally, even change it though not recommended, and JS has fast JIT, still likely missing out on SIMD optimization).

Is there a way to compile to WebAssembly, or planned, i.e. targeting one-word machine integers as is (not just 60-bit) and one-word floats, with full IEEE semantics (not sure JS does), also allowing for SIMD? And even 32-bit or smaller for both?

Another way is calling C or other language, or even compiling to C. I would suggest compiling to Julia (I discovered Gleam on Julia subreddit).

I suppose you fully support UTF-8, and likely only, e.g. for source code, as I see OTP now supports (before only ISO-8859-1 (Latin-1), and do you have anything only supporting it, or it better?).

@lpil
Copy link
Member

lpil commented Oct 18, 2024

Good suggestion, let's make this more clear in the documentation.

There are no plans for additional compilation targets presently.

@lpil lpil transferred this issue from gleam-lang/gleam Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants