Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2010 The Go Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style | |
3 // license that can be found in the LICENSE file. | |
4 | |
5 package cmath | |
6 | |
7 import "math" | |
8 | |
9 // IsInf(x) returns true if either real(x) or imag(x) is an infinity. | |
10 func IsInf(x complex128) bool { | |
11 // TODO(rsc) remove inlining whem compiler does it for us | |
rsc1
2010/04/02 07:13:53
Not worth it in this one:
return math.IsInf(real(
| |
12 if real(x) < -math.MaxFloat64 || real(x) > math.MaxFloat64 || imag(x) < -math.MaxFloat64 || imag(x) > math.MaxFloat64 { // if math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) { | |
13 return true | |
14 } | |
15 return false | |
16 } | |
17 | |
18 // Inf() returns a complex infinity. | |
rsc1
2010/04/02 07:13:53
// Inf returns a complex infinity, cmplx(+Inf, +In
| |
19 func Inf() complex128 { | |
20 inf := math.Inf(1) | |
21 return cmplx(inf, inf) | |
22 } | |
OLD | NEW |