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

[C++] _dateStr overflow affects subsequent floating point numbers #164

Closed
kseistrup opened this issue Jul 15, 2024 · 5 comments
Closed

[C++] _dateStr overflow affects subsequent floating point numbers #164

kseistrup opened this issue Jul 15, 2024 · 5 comments

Comments

@kseistrup
Copy link

REPL

» miniscript
MiniScript 
Command-Line (Linux) v1.3; language v1.6.2 (Jul 15 2024)
> // # This is fine:
> sqrt(2)
1.414214
> 1.2345
1.2345
> _dateStr 77777777777777777
-1830285635-101-00 20:56:16
> // # But now everything is fscked up:
> sqrt(2)
1,414214
> 1.2345
1
> 1,2345
Compiler Error: got Comma where number, string, or identifier is required [line 1]

Scripting

» cat float.ms
#!/usr/bin/env miniscript

print sqrt(2)
print 1.2345
print _dateStr(77777777777777777)
print sqrt(2)
print 1.2345
print 1,2345

// eof
» chmod +x float.ms
» ./float.ms
1.414214
1.2345
-1830285635-101-00 20:56:16
1,414214
1,2345
12345<EOL>  # no line feed

Locale

LANG=en_DK.UTF-8
LC_ALL=en_DK.UTF-8
@kseistrup
Copy link
Author

📎 float.ms

@kseistrup
Copy link
Author

kseistrup commented Jul 15, 2024

Also, because _dateStr(77777777777777777) seems to wreak havoc:

MiniScript 
Command-Line (Linux) v1.3; language v1.6.2 (Jul 15 2024)
> _dateStr 77777777777777777
-1830285635-101-00 20:56:16
> _dateStr 77777777777777777
-1830285635--817198303-32767 20:56:16

edit: typo

@marcgurevitx
Copy link
Contributor

@kseistrup Are those still reproduced after this patch is applied? #162

@kseistrup
Copy link
Author

@marcgurevitx

No, then I just get an empty string for overflowing dates, and subsequent floating points are unaffected.

(I'm not on Windows, I only inserted the two new lines 35+36 since everything else seemed irrelevant.)

👍

@JoeStrout
Copy link
Owner

Closing thanks to PR#162.

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

3 participants