Open tvt173 opened 2 weeks ago
Hmm, interesting. I misread the API of KLayout. The reason this happens is that the C++ API expectes/produces unsigned integers :( (and since -1 will be mapped to the biggest unsigned int64, you can imagine where the numbers will land roughly).
For now I can make a check in there and use as you said the sign separately. I can ask whether it's reasonable to modify the overloads to work on signed int/float as well.
Describe the bug Calling
to_dbu
on postive numbers works great. Calling it on negative numbers however, produces garbage. Try this:Expected result: -400 Actual result: 4294966896
It's not uncommon, for example, to pass a sizing value in microns, which might be negative. In this case, doing so causes the application to crash.
A potential workaround could be to do whatever operation is inside here on the abs() of the value passed and then multiply the final result back by the sign