Solved

Dimensions round-ups

  • 21 November 2023
  • 5 replies
  • 67 views

Userlevel 1

I am trying to understand what criteria dictates Zemax to round up decimals.

For instance: in the Aperture setting below. I inserted the following values and got rounded up values

  1. X-Half Width: 8.325 → Zemax value = 8.325
  2. Y-Half Width: 10.125 → Zemax value = 10.13

Why does Zemax treat the first entry differently from the second? It shouldn’t round up 8.325 differently than 10.125. But, it does. Can someone please explain to me if this is a possible bug or there is an internal logic that dictates how round-ups happen in Zemax.

Thanks - ASuku

icon

Best answer by Sean Turner 22 November 2023, 17:10

View original

5 replies

Userlevel 4
Badge

Hi Asuku,

Just a guess: perhaps 10.125 is seen internally as 1.0125 E-1, thus rounded to 1.013 E-1 = 10.13.

Userlevel 3
Badge +1

This is controlled with the Significant Digits setting.

From the help manual:
Significant Digits Controls the number of digits shown for values in the editor properties dialog and the analysis settings dialog. For example, if the number of significant digits is set to “3” (the default), and an aperture on a surface in the Lens Data Editor has radius of 1.2345, then the value displayed in the Properties > Aperture dialog will be 1.23.

 

Userlevel 4
Badge +1

To add to Sean’s answer, the Editors tab also has a setting for this, controlling the display in the editors, while the General controls other displays. These are both strictly for display, and the actual value is stored in full floating resolution.

Userlevel 7
Badge +2

To complement @Kevin Scales reply, if one manually types: 1.23456789 in the X-Half Width aperture field of a surface, it might display as 1.23 (depending on the display settings):

But if we use the ZOSAPI to print the actual X-Half Width value with this line of code (Python):

print(TheSystem.LDE.GetSurfaceAt(1).ApertureData.CurrentTypeSettings._S_RectangularAperture.XHalfWidth)

The result is:

1.23456789

Take care,

 

David

Userlevel 7
Badge +3

Just one small point. OS stores all ray and lens system data to 64-bit precison, and all the ‘significant digit’ stuff does is set the formatting of the number when it’s printed in the LDE or some other place. There’s no rounding of the data used in the calculations, just in what is displayed in a text string that represents the value of a double-precision float. 

Edit: Oops, Kevin already said that in fewer words 😎 

Reply