-
Notifications
You must be signed in to change notification settings - Fork 50
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
Optionally set data type #115
Comments
Reads ought to be in double precision, is that not happening? |
Yeah, but you can't represent some numbers perfectly with floating point, so you get weird results in some cases. See the linked |
Oh, I see, you do not want to use base2 floating point... |
Not possible to make adding to/modifying this array user settable through API? https://github.com/marshallward/f90nml/blob/master/f90nml/parser.py#L725 |
It may be possible, but a bit against the spirit of the module. For one thing, there's no way to indicate that the number is base10 in the namelist. (Theoretically one could assign a base10 "kind"; however, kind cannot be assigned in a namelist, nor have I ever seen a compiler actually do this, so let's ignore that possibility). So we would have to introduce new infrastructure which lets us pre-assign a type to this data, presumably with some sort of metadata during initialization of the Before considering this, would something like this work for you?
Would something like that work? If not, then let's keep talking. |
BTW this has come up before, and I resisted it back then, but perhaps I should be more open to allowing users to add new types to that list, and providing some infrastructure to access them. In my opinion, such an entity would no longer be a namelist, but I can see how it could be useful. |
Clearly you've thought this through before, and I can see what you're saying, this is input into a program which is using base2 floating point. I'd say leave it and just point me back to this issue when I forget I've raised this before and whinge again! |
BTW it was not you who had suggested it before! I am coming around to the idea of letting users add their own types, I will keep that one in mind. |
When reading in namelists I would like to be able to preserve the precision of the values being read in using the python decimal library. If numerical values are converted from string to a numerical type makes it more difficult to do this.
Options to support this might be to specify only strings to be returned when read in, or specify
decimal.Decimal
as one of the types to cast to.The text was updated successfully, but these errors were encountered: