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

Improving precision in array retrieval #2955

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Apr 1, 2024

As the title.

Simple change but it seems effective.

Instead of printing the array using floating numbers (F) we use exponential (E).

Before

((.venv_py312) ) ➜  pymapdl git:(feat/more-precision-retrieving-arrays) ✗ python tmp/main.py
[ 0.000e+00  0.000e+00 -4.580e-10 -8.780e-10 -2.180e-10 -2.680e-10
 -3.790e-10 -5.410e-10 -4.700e-10 -8.150e-10  4.580e-10 -8.780e-10
  0.000e+00 -1.473e-09  0.000e+00  0.000e+00  4.700e-10 -8.150e-10
  3.790e-10 -5.410e-10  2.180e-10 -2.680e-10  0.000e+00  0.000e+00
  0.000e+00 -1.910e-10  0.000e+00 -4.900e-10  0.000e+00 -8.640e-10]
-4.58e-10

After change

((.venv_py312) ) ➜  pymapdl git:(feat/more-precision-retrieving-arrays) ✗ python tmp/main.py
[ 0.00000000e+00  0.00000000e+00 -4.58300835e-10 -8.78066913e-10
 -2.18264131e-10 -2.68102076e-10 -3.78991840e-10 -5.41040242e-10
 -4.70445287e-10 -8.15032225e-10  4.58300835e-10 -8.78066913e-10
  8.95900195e-26 -1.47316722e-09  0.00000000e+00  0.00000000e+00
  4.70445287e-10 -8.15032225e-10  3.78991840e-10 -5.41040242e-10
  2.18264131e-10 -2.68102076e-10  0.00000000e+00  0.00000000e+00
  4.44206888e-26 -1.90657946e-10  1.43633916e-25 -4.90177355e-10
  1.15997145e-25 -8.64297293e-10]
-4.58300835113e-10

Model used for testing

Using the example given in #2939

Close #2939

@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@germa89
Copy link
Collaborator Author

germa89 commented Apr 1, 2024

Pinging @koubaa @mikerife @FredAns just to make sure I'm using right format/approach.

@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.11%. Comparing base (3a14565) to head (8329da9).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2955      +/-   ##
==========================================
- Coverage   86.67%   84.11%   -2.56%     
==========================================
  Files          48       48              
  Lines        9469     9469              
==========================================
- Hits         8207     7965     -242     
- Misses       1262     1504     +242     

@mikerife
Copy link

mikerife commented Apr 1, 2024

I like this a lot!

@germa89 germa89 merged commit d16b9b3 into main Apr 1, 2024
36 checks passed
@germa89 germa89 deleted the feat/more-precision-retrieving-arrays branch April 1, 2024 17:36
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

Successfully merging this pull request may close these issues.

Low precision in array retrieval
4 participants