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

"ln" function fails #21

Open
prof55 opened this issue Mar 8, 2023 · 19 comments
Open

"ln" function fails #21

prof55 opened this issue Mar 8, 2023 · 19 comments

Comments

@prof55
Copy link

prof55 commented Mar 8, 2023

Dear Sir,
I admire your work. I want to contribute bug-hunting with the following issue. Look please at this small test:


1 x = 3
2 y = ln(x)
3 output = y "= ln(" x ")"
4 end
err.sbl(2) : error 307 -- ln produced real overflow


Obviously, the error reported does not fit. I have an older version of spitbol (3.81) which runs normally. Could you please investigate this issue? Thank you in advance.
prof55

@CheyenneWills
Copy link
Contributor

Thanks for the report. I'll take a look at it.

@CheyenneWills
Copy link
Contributor

I see the problem, will have to dig a bit to figure out the proper fix.

Basically the math_op macro that wraps the floating point functions isn't checking for overflow correctly.

@CheyenneWills
Copy link
Contributor

I believe I have a fix for this, but I need to run some tests to verify the floating point functions as well as the floating point arithmetic functions, specifically at some of limits (e.g. overflows, underflows, etc.)

@CheyenneWills
Copy link
Contributor

I have a fix for the specific problem, but in setting up a test suite to verify, I've ran into another problem that will need to be fixed as well.

@CheyenneWills
Copy link
Contributor

I believe that I have figured out the problem, and I'm in the process of creating a test suite for the math operations and functions.

@CheyenneWills
Copy link
Contributor

Just a quick status update..

Fixing this specific problem has exposed several other issues that I am working through. I'm still stepping through individual tests for the different math related functions / operators.

CheyenneWills referenced this issue Jun 15, 2023
Working with floating point values were not handling errors correctly.

Most of the heavy lifting of performing floating point operations are
performed within C code.  Errors were not being properly caught which
resulted in invalid results.

Use the C99 provided functions for handling floating point exceptions.
@CheyenneWills
Copy link
Contributor

I've pushed a development branch that should address this problem.

I'll be asking some folks to see if they can test this and provide any feedback before promoting it to the main branch

@prof55
Copy link
Author

prof55 commented Jun 16, 2023 via email

@CheyenneWills
Copy link
Contributor

Thanks for the report.

Can you provide information about your system: what type of processor, which os distribution and what level it is, and could you do a 'ldd sbl40b' ?

Also if you have the ability can you try rebuilding spitbol on your machine?

You will need nasm and gcc.

make bootsbl
make BASEBOL=./bootsbl spitbol

This should create a new sbl file in the top directory of the source tree.

(and yes .. the makefile needs to be cleaned up more)

Thanks

@prof55
Copy link
Author

prof55 commented Jun 18, 2023 via email

@CheyenneWills
Copy link
Contributor

CheyenneWills commented Jun 20, 2023

I've been unable to reproduce the problem using an ubunutu 20 virtual machine (only difference is the actual processor type).

Make sure that you are checking out the development branch.

git clone https://github.com/spitbol/x64.git     -- creates a clone of the git repo (if you haven't already done this)
cd x64
git fetch                     -- just make sure you have the lastest from github (not needed if you do a fresh git clone
git checkout development
# You can try the './bin/sbl' at this point 
# or rebuild (assuming you have nasm and gcc)
make bootsbl
make BASEBOL=./bootsbl spitbol
# Then try the './sbl'

@CheyenneWills
Copy link
Contributor

Dr. Imre Bartfai,

I'm wondering if you are still having a problem with the above instructions?

If you are still having problems, could you possibly produce a core file and attach it?

ulimit -c unlimited
{run the file that is causing the segfault}

@prof55
Copy link
Author

prof55 commented Jul 1, 2023

Reply to previous letter:
thank you for your detailed instructions. Now I was able to have a local spitbol 4.0b. The "ln(" error is disappeared, however I can report now another bug (look at the attachment). The small program runs with spitbol 3.8.1 without problem.
The reported error does not fit. An interesting background information: if you comment out the statement #9 -- which actually a floating point comparison -- the error disappears. Look also at the statement count, as it is very small.

Thank you in advance.
KR Imre

Obviously, my previous letter is not arrived. Such way here is the reply:

I attached another very simple test file. It causes an overflow, too. Segfault did not happened. If I comment out line #6 (floating point comparison), the error disappears.
KR Imre
test2.lst.gz

@CheyenneWills
Copy link
Contributor

1st, glad to hear that you were able to get 4.0b "working", and 2nd, thanks for the error report.

There are several problems within floating point that I'm still picking through. I suspect the error you reported will be a fairly simple fix (and highlight more floating point problems).

@CheyenneWills
Copy link
Contributor

I know it's been a bit of time, but I just pushed version 4.0c for spitbol that contains a very large rework of the floating point support.

If you can give that version a try to see if you have any additional problems.

Thanks

@prof55
Copy link
Author

prof55 commented Oct 25, 2023 via email

@aksr
Copy link

aksr commented Oct 25, 2023

As it is easily confirmed, DATE() doesn't work. It would be nice, though.

@CheyenneWills
Copy link
Contributor

I've confirmed the date() problem and opened a new ticket for that. If you could follow issue #24

And for the crash, I need more information, I've opened an issue for that as well. I'll put in the issue what the information is that I need. See issue #25.

I would like to close this specific issue since the math functions seem to be working okay now, if that's okay with you.

Thanks

@prof55
Copy link
Author

prof55 commented Oct 25, 2023 via email

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