/mingw-w64-crt/complex/_cabs.c

https://gitlab.com/ubuntu-xenial/mingw-w64 · C · 61 lines · 10 code · 5 blank · 46 comment · 0 complexity · c85d1d77b14407e77f14bab639e98281 MD5 · raw file

  1. /*
  2. This Software is provided under the Zope Public License (ZPL) Version 2.1.
  3. Copyright (c) 2009, 2010 by the mingw-w64 project
  4. See the AUTHORS file for the list of contributors to the mingw-w64 project.
  5. This license has been certified as open source. It has also been designated
  6. as GPL compatible by the Free Software Foundation (FSF).
  7. Redistribution and use in source and binary forms, with or without
  8. modification, are permitted provided that the following conditions are met:
  9. 1. Redistributions in source code must retain the accompanying copyright
  10. notice, this list of conditions, and the following disclaimer.
  11. 2. Redistributions in binary form must reproduce the accompanying
  12. copyright notice, this list of conditions, and the following disclaimer
  13. in the documentation and/or other materials provided with the
  14. distribution.
  15. 3. Names of the copyright holders must not be used to endorse or promote
  16. products derived from this software without prior written permission
  17. from the copyright holders.
  18. 4. The right to distribute this software or to use it for any purpose does
  19. not give you the right to use Servicemarks (sm) or Trademarks (tm) of
  20. the copyright holders. Use of them is covered by separate agreement
  21. with the copyright holders.
  22. 5. If any files are modified, you must cause the modified files to carry
  23. prominent notices stating that you changed the files and the date of
  24. any change.
  25. Disclaimer
  26. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
  27. OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  28. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  29. EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
  30. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  31. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  32. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  33. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  34. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  35. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. #include <math.h>
  38. #include <complex.h>
  39. /* We implement this function to make sure we use always the C99 compatible
  40. routine. By this we fix an issue about 32-bit and 64-bit version of
  41. msvcrt, which differs in some corner-cases. */
  42. double __cdecl
  43. _cabs (struct _complex _ComplexA)
  44. {
  45. double _Complex a;
  46. __real__ a = _ComplexA.x;
  47. __imag__ a = _ComplexA.y;
  48. return cabs (a);
  49. }