Round database unit to the nearest attometer when reading from GDS2#1880
Round database unit to the nearest attometer when reading from GDS2#1880rocallahan wants to merge 1 commit intoKLayout:masterfrom
Conversation
Currently if you create a layout with a DBU of (e.g.) 16, write it to GDS2, and then read it again, you don't get exactly 16, but 16.000000000000004. It would be nice if reasonable database unit values roundtrip exactly.
dc18277 to
182553e
Compare
|
I guess I need to update other values to be consistent. I'll look into that tomorrow. |
|
Good point, but I guess the problem is somewhere else. Basically GDS is not able to exactly represent a DBU of 16 Mikrometers (OASIS and GDSTXT is). It has to pick a value close by and this is the hex string: Which decoded as base-16 float is: Due to the limitation of standard double float I guess this is evaluated as When I write such a GDS back, I get the same DBU hex string, so a round trip is safe. Your patch is just cosmetics as inside the GDS, the value would still not be 16 micron and any other tool reading the file sees this odd value. This is the point where I'd say there is little one can do, but it ocured to me that by picking a hex string that is off by 1: renders which is actually turned into 16.0. So I wonder why the GDS writer does not pick the smaller and more precise number. There is no obvious bug to me in the conversion code. There is some subtle numerical issue however - the following patch produces a better fit for the DBU value: I tend towards going that way. |
Yes, that will work for me. Thanks! I assume you don't need anything more from me. |
Currently if you create a layout with a DBU of (e.g.) 16, write it to GDS2, and then read it again, you don't get exactly 16, but 16.000000000000004. It would be nice if reasonable database unit values roundtrip exactly.