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

"VersionNumber" to stop returning 2.6, let it be 3.73 and so on? #425

Open
pinterf opened this issue Jan 27, 2025 · 3 comments
Open

"VersionNumber" to stop returning 2.6, let it be 3.73 and so on? #425

pinterf opened this issue Jan 27, 2025 · 3 comments

Comments

@pinterf
Copy link

pinterf commented Jan 27, 2025

Historically we returned AVS_CLASSIC_VERSION_NUMBER which was 2.60 at that time, some ten years ago.
Now I ask you to return a more meaningful number.
I know that our 3-part versioning does not fit nicely into this floating point logic, but anyway, let's return 3.73 or 3.74 or 3.8.

Firstly because now it is not nice, we can change it to a larger number without concerns. The only use case was to decide if the core is at least Avisynth 2.6 (and not 2.58 for example - there had been huge changes in Avisynth 2.6)
Secondly (real deal breaker), because there is no good choice of storing it internally as 32 bit float or double.

Unfortunately (double)2.6f < 2.6

avs_as_float / AsFloat() always returned double, our magic value 2.6 (32 bit float) becomes 2.5999999046... when it leaves an AVSValue as double.
Now, that we are (will be soon- with the 64 bit changes) able to deal with real 64 bit doubles, this conversion does not happen.

That is:

GetVersion() < 2.6 will be true so it will break the scripts, scripts will think we are in the 2.5x era.

All the scripts I know are using VersionNumber like this

avs26 = VersionNumber() < 2.60 ? false : true
sisavs26 = !(VersionNumber() < 2.60)
VersionNumber() < 2.6
Is26=VersionNumber>=2.6
versionnumber()>2.575

The only 'smart' comparison is for 2.58, it seems that the exact comparison with 2.58 was failing also, that's why the script writer was using 2.575 for safety.

The x264 project is using avs_get_version() when swscale not configured,
Which is getting the version number after a (float)(double)(float)(double)2.6 cast series, then compares with 2.6f.
It works O.K.

@qyot27
Copy link
Member

qyot27 commented Jan 27, 2025

From what I remember, AVS_CLASSIC_VERSION_NUMBER was intended as a way to signal it was compatible with this version of classic AviSynth, which would make more sense had classic survived long enough to actually move beyond 2.6. And that was because the regular versioning had moved on to show the Plus-specific stuff. Given that, IMO it'd be easier to just remove it entirely instead of changing it to match the other Plus things.

I don't even know what projects actually even rely on checking AVS_CLASSIC_VERSION_NUMBER, so I'm not sure what - if anything - would break from its removal.

What happens if it tries to return 2.61? That was only ever an alpha, but it was the final final version of classic, and we're definitely compatible with it too. I'll only say that 3.8 would definitely be wrong before we actually make that jump ourselves.

@pinterf
Copy link
Author

pinterf commented Jan 27, 2025

I just experimented with small changes.

2.600000024f is a good choice, in SubTitle(String(VersionNumber()) it's shown as 2.6000000.
And as AsFloat returns it in double, it works in the scripts: VersionNumber() >= 2.6 is true, yeah.

@pinterf
Copy link
Author

pinterf commented Jan 27, 2025

This VersionNumber() is the only usage of AVS_CLASSIC_VERSION_NUMBER.

I'll only say that 3.8 would definitely be wrong before we actually make that jump ourselves.

O.K., I'm not changing it prematurely.

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