Post Reply 
Plus42: incorrect behaviour in equation using temperature UOM
05-27-2024, 04:21 PM (This post was last modified: 05-27-2024 04:58 PM by Thomas Okken.)
Post: #4
RE: Plus42: incorrect behaviour in equation using temperature UOM
This is indeed a bug.

When the numeric solver calls the function to be solved and receives a return value with an attached unit, it needs to get rid of the unit before being able to use the return value in the root finding iteration algorithm. This unit removal needs to be done in a way that gives consistent results, even if the function can return results with different units at different iterations. (Of course the units returned by the function must always be consistent between iterations: returning m in one iteration and ft in another is fine, but returning m in one iteration and m^2 in another is not.)

The current implementation performs this consistent unit removal using UBASE and then UVAL. This works fine in most cases, except with °C and °F, because of the offset introduced when UBASE converts those to K.

This could be fixed by remembering the unit returned by the first successful call of the function to be solved, and converting all subsequent return values to that initial unit using CONVERT, and then using UVAL to get the scalar. Or maybe °C and °F should be handled completely separately and not be considered compatible with anything, even each other.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Plus42: incorrect behaviour in equation using temperature UOM - Thomas Okken - 05-27-2024 04:21 PM



User(s) browsing this thread: 2 Guest(s)