Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Side by Side Diff: src/pkg/cmath/isinf.go

Issue 874041: code review 874041: cmath pkg (Closed)
Patch Set: code review 874041: cmath pkg Created 15 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b