Skip to main content
Solved

Dimensions round-ups

  • November 21, 2023
  • 5 replies
  • 182 views

  • Ultraviolet
  • 30 replies

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

Best answer by Sean Turner

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.

 

View original
Did this topic help you find an answer to your question?

5 replies

Forum|alt.badge.img
  • Fully Spectral
  • 104 replies
  • November 22, 2023

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.


Sean Turner
Fully Spectral
Forum|alt.badge.img+1
  • Fully Spectral
  • 97 replies
  • Answer
  • November 22, 2023

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.

 


Kevin Scales
En-Lightened
Forum|alt.badge.img+1
  • En-Lightened
  • 185 replies
  • November 29, 2023

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.


David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1123 replies
  • November 29, 2023

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


Mark.Nicholson
Luminary
Forum|alt.badge.img+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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings