-
Notifications
You must be signed in to change notification settings - Fork 93
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
Inconsistent rounding for parameters in savename #350
Comments
Great! Thanks a lot for the great bug report! I agree with your suggestion for the fix, if anyone wants to do a PR this seems rather simple! |
Adding edit: which is a feature I would like. |
Hello, I tried working on this issue, making changes to the How do I pass a variable to the format string in I am currently doing the following:
Which results in:
What can be the way out here? Is there an alternative method? |
When using
savename
, some unexpected behaviour can happen when using some parameter values with thesigdigits
keyword. This seems to be due to the fact thatsavename
uses theround
function to format numbers, which is designed for outputting numbers as strings. One issue occurs when using very small or large numbers, and is due to a known bug inround
, but is machine specific.For example,
but for one order of magnitude larger
Additionally, while it may round the correct number of significant digits, the output will not necessarily represent the specified number of significant digits. Specifically, this occurs when there should be additional zeros, which are either not be added to the given number, or are dropped when the number rounds to something that can be represented with fewer digits. For example,
It would probably be more robust to use string formatting methods, for example the Printf.@sprintf macro, to produce the final string after using the
round
function.I am using DrWatson v2.9.1 and julia version 1.7.3.
The text was updated successfully, but these errors were encountered: