# NaN Hz and NearestResolution

**URL:** <https://psychtoolbox.discourse.group/t/nan-hz-and-nearestresolution/884>\
**Category:** Uncategorized\
**Created:** [September 18, 2001, 2:49am UTC](https://psychtoolbox.discourse.group/t/nan-hz-and-nearestresolution/884 "2001-09-18T02:49:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [September 18, 2001, 2:49am UTC](https://psychtoolbox.discourse.group/t/nan-hz-and-nearestresolution/884/1 "2001-09-18T02:49:05Z")

</div>

Testing the PsychToolbox on his iBook, Frans Cornelissen, discovered and   
reported a bug:  

> \> A tiny issue is that "NearestResolution"   
> \> will not correctly find the resolution requested when 'hz' is set to   
> \> anything else but NaN.

A new, fixed, version of NearestResolution is enclosed. It will ignore   
frame rate when frame rate information is lacking (ie NaN).  
  
The underlying problem is that at least some built-in LCD screen drivers   
(iBook, G4 PowerBook, and probably others) report the frame rate as NaN   
Hz for all video modes. (I haven't gone back to check Apple's rules; this   
may qualify as a driver bug.) This value is, in turn, reported by SCREEN   
'Resolution' and 'Resolutions'. You can always get the actual frame rate   
for the current mode by calling FrameRate, which provides the result of   
an accurate measurement rather than asking the driver. However, with   
these drivers there is no way to find out what frame rate a non-current   
mode would run at, except for switching to that mode and measuring it, eg   
by calling FrameRate. It is tempting to simply assume that the actual   
rate is 60 Hz whenever the returned value is NaN, but I can't think of   
any reason that this should always be true.  
  
ResolutionTest will reveal whether your drivers report frame rate or not.  
  
best  
  
denis  
  
p.s.  
The new NearestResolution.m is enclosed. It will be incorporated in the   
next release of PsychToolbox.  
  
  
NOTE: [denis.pelli@...](mailto:denis.pelli@...) is my preferred email address. Please use that   
address. My "verizon.net" address will go away soon, partly because   
Verizon forces me to use that as my return address.
