File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 35
35
36
36
import RealModule
37
37
38
- // TODO: uncomment conformance once all implementations are provided.
39
38
extension Complex : ElementaryFunctions {
40
39
41
40
// MARK: - exp-like functions
@@ -343,10 +342,11 @@ extension Complex: ElementaryFunctions {
343
342
// be quite painful to calculate. Instead, we can use an approach that
344
343
// NevinBR suggested on the Swift forums:
345
344
//
346
- // Re(log 1+z) = (log 1+z + log 1+z̅)/2
347
- // = log((1+z)(1+z̅)/2
348
- // = log(1+z+z̅+zz̅)/2
349
- // = log((2+x)x + y²)/2
345
+ // Re(log(1+z)) = (log(1+z) + log(1+z̅)) / 2
346
+ // = log((1+z)(1+z̅)) / 2
347
+ // = log(1 + z + z̅ + zz̅) / 2
348
+ // = log(1 + 2x + x² + y²) / 2
349
+ // = log(onePlus: (2+x)x + y²) / 2
350
350
//
351
351
// So now we need to evaluate (2+x)x + y² accurately. To do this,
352
352
// we employ augmented arithmetic; the key observation here is that
You can’t perform that action at this time.
0 commit comments