=========================================================================================
 Copyright © 2022 Peter Jäckel.
 
 Permission to use, copy, modify, and distribute this software is freely granted,
 provided that this notice is preserved.

 WARRANTY DISCLAIMER
 The Software is provided "as is" without warranty of any kind, either express or implied,
 including without limitation any implied warranties of condition, uninterrupted use,
 merchantability, fitness for a particular purpose, or non-infringement.
==========================================================================================

 /////////////////////////////////////////////////////////////////////////////////////////
 //
 // This is a reference implementation of the analytical normal (Bachelier) implied
 // volatility function by Peter Jaeckel, © 2016-2022.
 //
 // See www.jaeckel.org/ImpliedNormalVolatility.pdf for details of the mathematics,
 // published January 2017; Wilmott, pages 52-54, March 2017.
 //
 /////////////////////////////////////////////////////////////////////////////////////////

 The main function is
     double ImpliedNormalVolatility(double price, double forward, double strike, double T, double q /* q=±1 for calls/puts */)
 in file ImpliedNormalVolatility.cpp. Since the Bachelier price function incurs massive subtractive cancellation errors when evaluated naively, we also provide a precise implementation for it. Its signature is
     double Bachelier(double forward, double strike, double sigma, double T, double q /* q=±1 for calls/puts */)
 and it is also implemented in file ImpliedNormalVolatility.cpp.

 The XLL wrapper code automatically detects if the respectively used version of Excel provides the Excel-12 API or only the earlier Excel-4 API, and uses the higher available version. Note that 64 bit versions of Excel (afaik) only provide the Excel-12 API.

 The XLL wrapper code is fairly generic and can be used to build other XLLs, 32 bit or 64 bit. By default, without the definition of the preprocessor macro XL_CATEGORY_NAME, the code detects the name of the XLL at run time, and registers all provided Excel worksheet functions under that base name as the Excel "category" name. You can override this by giving a C/C++ preprocessor macro definition such as -DXL_CATEGORY_NAME=ImpliedNormalVolatility or similar. Caution: if you rename the XLL file, the Excel category of the provided functions changes in Excel, and any functions defined with the category as a prefix [e.g., ImpliedNormalVolatility.Bachelier(forward,strike,sigma,T,q)], then appear with a different effective name since the prefix changes, too! This, however, may be desirable since you may want to prevent anyone renaming the XLL anyway.

==========================================================================================
 WARRANTY DISCLAIMER
 The Software is provided "as is" without warranty of any kind, either express or implied,
 including without limitation any implied warranties of condition, uninterrupted use,
 merchantability, fitness for a particular purpose, or non-infringement.
==========================================================================================
