找不到swift darwin文档

Tho*_*hor 7 darwin sqrt ios swift

我正在玩swift,并有以下简单的代码

在此输入图像描述

我想检查"sqrt"函数是如何实现的,所以我试图点击"Darwin.C.math"链接但没有任何反应.我用谷歌搜索了"斯威夫特达尔文苹果文档",但没有关于"达尔文"的消息.那么有人可以告诉我,我如何找到"sqrt"功能的文档?

在java中,当我单击类名或方法名时,将出现源代码文件,其中包含有关如何实现方法和类的所有详细信息.但我似乎无法对swift/xcode做同样的事情.

Sup*_*tar 3

Darwin 是 Apple开源项目的一部分。在那里您可以查看 macOS(如11.2)和 iOS(如13.5.1 )中的所有开源软件,以及有关Darwin 和 Apple 通过 BSD 实现 Unix 的方法的文档。

此外,大多数 Darwin API 都是 UNIX 规范的实现(有一些显着的差异),因此只需查找许多 UNIX 文档站点之一,如下所示:

ETC

您还可以通过 CLI 在计算机上使用手册页。例如,在您的用例中,只需打开终端并输入man sqrt

SQRT(3)                  BSD Library Functions Manual                  SQRT(3)

NAME
     sqrt -- square root function

SYNOPSIS
     #include <math.h>

     double
     sqrt(double x);

     long double
     sqrtl(long double x);

     float
     sqrtf(float x);

DESCRIPTION
     The sqrt() function compute the non-negative square root of x.

SPECIAL VALUES
     sqrt(-0) returns -0.

     sqrt(x) returns a NaN and generates a domain error for x < 0.

VECTOR OPERATIONS
     If you need to apply the sqrt() function to SIMD vectors or arrays, using the following functions provided by the Accelerate.frame-
     work may give significantly better performance:

     #include <Accelerate/Accelerate.h>

     vFloat vsqrtf(vFloat x);
     vFloat vrsqrtf(vFloat x);
     void vvsqrtf(float *y, const float *x, const int *n);
     void vvsqrt(double *y, const double *x, const int *n);
     void vvrsqrtf(float *y, const float *x, const int *n);
     void vvrsqrt(double *y, const double *x, const int *n);

SEE ALSO
     math(3)

STANDARDS
     The sqrt() function conforms to ISO/IEC 9899:2011.

BSD                            December 11, 2006                           BSD
Run Code Online (Sandbox Code Playgroud)

如果更符合您的风格,您还可以使用在线手册页: https: //www.freebsd.org/cgi/man.cgi