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

numbers (int and float) are too verbose in phi #976

Open
yegor256 opened this issue Jan 20, 2025 · 5 comments
Open

numbers (int and float) are too verbose in phi #976

yegor256 opened this issue Jan 20, 2025 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@yegor256
Copy link
Member

This is what I see in the XMIR after disassemble:

<o base="jeo.int">
  <o base="org.eolang.bytes">00-00-00-00-00-00-00-00</o>
</o>

Instead, if we have this:

<o base="jeo.int">
  <o base="org.eolang.number">
    <o base="org.eolang.bytes">00-00-00-00-00-00-00-00</o>
  </o>
</o>

The phi-expression will look much more readable.

@yegor256
Copy link
Member Author

@volodya-lombrozo please, check

@volodya-lombrozo volodya-lombrozo self-assigned this Jan 21, 2025
@volodya-lombrozo volodya-lombrozo added the enhancement New feature or request label Jan 21, 2025
@volodya-lombrozo
Copy link
Member

@yegor256 Does objectionary/eo have some abstraction over org.eolang.number? I'm afraid if I will use my own
transformation strategy, we will see different numbers in the end.

I would want to use something like the following:

new EoNumber(1L).toBytes()
new EoNumber(1).toBytes()
...

@yegor256
Copy link
Member Author

@volodya-lombrozo in EO, number is a double-precision 64-bit binary format IEEE 754. There is no such thing as integer in EO. In this aspect, we are very similar to JavaScript.

@volodya-lombrozo
Copy link
Member

volodya-lombrozo commented Jan 21, 2025

@yegor256 Do you already have some Java class that converts any number to this representation? It's better to reuse it, rather than to write it one more time.

@yegor256
Copy link
Member Author

yegor256 commented Jan 21, 2025

@volodya-lombrozo this should work:

var x = // whatever you have, either int, long, float, or double
var y = (double) x;

volodya-lombrozo added a commit to volodya-lombrozo/jeo-maven-plugin that referenced this issue Jan 22, 2025
volodya-lombrozo added a commit to volodya-lombrozo/jeo-maven-plugin that referenced this issue Jan 22, 2025
volodya-lombrozo added a commit to volodya-lombrozo/jeo-maven-plugin that referenced this issue Jan 22, 2025
volodya-lombrozo added a commit to volodya-lombrozo/jeo-maven-plugin that referenced this issue Jan 22, 2025
volodya-lombrozo added a commit to volodya-lombrozo/jeo-maven-plugin that referenced this issue Jan 22, 2025
volodya-lombrozo added a commit to volodya-lombrozo/jeo-maven-plugin that referenced this issue Jan 22, 2025
volodya-lombrozo added a commit to volodya-lombrozo/jeo-maven-plugin that referenced this issue Jan 22, 2025
volodya-lombrozo added a commit to volodya-lombrozo/jeo-maven-plugin that referenced this issue Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants