37+ results for 'while !isfinite(x)' (0 ms)

Not the results you expected?

Numbers.js (git://github.com/mbostock/protovis.git) JavaScript · 313 lines

25 stop -= (stop - start) * 1e-10; // floating point precision!

26 if (step < 0) {

27 while ((j = start + step * i++) > stop) {

28 array.push(j);

29 }

30 } else {

31 while ((j = start + step * i++) < stop) {

32 array.push(j);

33 }

266 */

267 pv.logAdjusted = function(x, b) {

268 if (!isFinite(x)) return x;

269 var negative = x < 0;

270 if (x < b) x += (b - x) / b;

random.js (https://github.com/mattdesl/canvas-sketch-util.git) JavaScript · 328 lines

65 function valueNonZero () {

66 var u = 0;

67 while (u === 0) u = value();

68 return u;

69 }

87

88 function noise1D (x, frequency, amplitude) {

89 if (!isFinite(x)) throw new TypeError('x component for noise() must be finite');

90 frequency = defined(frequency, 1);

91 amplitude = defined(amplitude, 1);

94

95 function noise2D (x, y, frequency, amplitude) {

96 if (!isFinite(x)) throw new TypeError('x component for noise() must be finite');

97 if (!isFinite(y)) throw new TypeError('y component for noise() must be finite');

98 frequency = defined(frequency, 1);

luroth_expansion.hpp (https://github.com/VoltDB/voltdb.git) C++ Header · 138 lines

25 using std::sqrt;

26 using std::isfinite;

27 if (!isfinite(x))

28 {

29 throw std::domain_error("Cannot convert non-finites into a Lüroth representation.");

47 Real i = 1;

48 Real scale = std::numeric_limits<Real>::epsilon()*abs(x_)/2;

49 while (abs(x_ - computed) > (i++)*scale)

50 {

51 Real recip = 1/x;

caml_int64.js (https://github.com/phated/reasonable.git) JavaScript · 626 lines

179

180 function mul(_this, _other) {

181 while(true) {

182 var other = _other;

183 var $$this = _this;

366

367 function of_float(x) {

368 if (isNaN(x) || !isFinite(x)) {

369 return zero;

370 } else if (x <= neg_two_ptr_63) {

385

386 function div(_self, _other) {

387 while(true) {

388 var other = _other;

389 var self = _self;

blue_641922.js (https://github.com/Microsoft/ChakraCore.git) JavaScript · 92 lines

11 function test0() {

12 function makeArrayLength(x) {

13 if (x < 1 || x > 4294967295 || x != x || isNaN(x) || !isFinite(x)) return 100;

14 else return Math.floor(x) & 0xffff;

15 };;

72 function func7() {}

73 }

74 } while (((~((new Error('abc')) instanceof((typeof RegExp == 'function') ? RegExp : Object)))) && __loopvar0 < 3)

75 if ((((protoObj1.prop1--) != (((VarArr0.unshift(((parseInt("-60") instanceof((typeof EvalError == 'function') ? EvalError : Object)) instanceof((typeof Error == 'function') ? Error : Object)), (++protoObj1.length), ((-1773563946 * 84 + 4294967296) == arrObj0.prop1), (arrObj0.prop0 %= aliasOfi16[(protoObj0.prop0) & 255]), ({}

76 instanceof((typeof EvalError == 'function') ? EvalError : Object)), (('prop0' in arrObj0) * ((d ? 468055979.1 : h) + 773168218.1)), (('prop0' in arrObj0) ? (-1.85965069094854E+18 >= -221) : -147671108.9), ((-527800715 ? f : arrObj0.prop0) ? aliasOfIntArr0[(((protoObj0.prop0 >= 0 ? protoObj0.prop0 : 0)) & 0XF)] : (('prop0' in arrObj0) * ((d ? 468055979.1 : h) + 773168218.1))), arrObj0.length, protoObj0.prop0)) * aliasOfFloatArr0[(18)] - ui8[((FloatArr2[(38)] * (test0.caller) - aliasOfIntArr0[(((protoObj0.prop0 >= 0 ? protoObj0.prop0 : 0)) & 0XF)])) & 255]) * (h >>>= func0()) - (protoObj0.prop1 >= protoObj1.prop0))) != (parseInt("-60") instanceof((typeof EvalError == 'function') ? EvalError : Object)))) {

engel_expansion.hpp (https://github.com/nickorr/BaseElements-Plugin.git) C++ Header · 115 lines

25 using std::sqrt;

26 using std::isfinite;

27 if (!isfinite(x))

28 {

29 throw std::domain_error("Cannot convert non-finites into an Engel expansion.");

43 Real scale = std::numeric_limits<Real>::epsilon()*abs(x_)/2;

44 Real u = x;

45 while (abs(x_ - computed) > (i++)*scale)

46 {

47 Real recip = 1/u;

download.jl (https://github.com/JuliaWeb/HTTP.jl.git) Julia · 147 lines

92 function download(url::AbstractString, local_path=nothing, headers=Header[]; update_period=1, kw...)

93 format_progress(x) = round(x, digits=4)

94 format_bytes(x) = !isfinite(x) ? "∞ B" : Base.format_bytes(x)

95 format_seconds(x) = "$(round(x; digits=2)) s"

96 format_bytes_per_second(x) = format_bytes(x) * "/s"

131

132 Base.open(file, "w") do fh

133 while(!eof(stream))

134 downloaded_bytes += write(fh, readavailable(stream))

135 if !isinf(update_period)

caml_int64.js (https://github.com/BuckleScript/bucklescript.git) JavaScript · 595 lines

162

163 function mul(_this, _other) {

164 while(true) {

165 var other = _other;

166 var $$this = _this;

319

320 function of_float(x) {

321 if (isNaN(x) || !isFinite(x)) {

322 return zero;

323 } else if (x <= -9.22337203685477581e+18) {

377

378 function div(_self, _other) {

379 while(true) {

380 var other = _other;

381 var self = _self;

centered_continued_fraction.hpp (https://bitbucket.org/bosp/external-boost.git) C++ Header · 166 lines

35 using std::sqrt;

36 using std::isfinite;

37 if (!isfinite(x))

38 {

39 throw std::domain_error("Cannot convert non-finites into continued fractions.");

56 Real D = 0;

57 int i = 0;

58 while (abs(f - x_) >= (1 + i++)*std::numeric_limits<Real>::epsilon()*abs(x_))

59 {

60 bj = round(x);

luroth_expansion.hpp (https://bitbucket.org/bosp/external-boost.git) C++ Header · 138 lines

25 using std::sqrt;

26 using std::isfinite;

27 if (!isfinite(x))

28 {

29 throw std::domain_error("Cannot convert non-finites into a Luroth representation.");

47 Real i = 1;

48 Real scale = std::numeric_limits<Real>::epsilon()*abs(x_)/2;

49 while (abs(x_ - computed) > (i++)*scale)

50 {

51 Real recip = 1/x;

generator.js (https://github.com/PatMartin/Dex.git) JavaScript · 207 lines

108 z = ztu(t,u);

109 if (isNaN(x) || (x == Number.NEGATIVE_INFINITY) ||

110 (x == Number.POSITIVE_INFINITY) || (Math.abs(x) > 2e5) || !isFinite(x)) {

111 //x=0;

112 x = Number.NaN;

154

155 var xi = 0, yi = 0, c, max_yi = 140, max_xi = 140;

156 while (theta <= piA)

157 {

158 phi = -piB/2;

160 r1 = Math.pow(Math.pow(Math.abs((1/a)*Math.cos(m*theta/4)),n2)+Math.pow(Math.abs((1/b)*Math.sin(m*theta/4)),n3),-1/n1);

161 yi = 0;

162 while (phi <= piB/2)

163 {

164 //r2 = 1/Math.pow((Math.pow(Math.abs(Math.cos(m*phi/4)/a)),n2)+Math.pow((Math.abs(Math.sin(m*phi/4)/b)),n3),n1);

floor.c (git://github.com/jeremybarnes/cephes.git) C · 453 lines

121 #endif

122 #ifdef INFINITIES

123 if(!isfinite(x))

124 return(x);

125 #endif

184 #endif

185 #ifdef INFINITIES

186 if(!isfinite(x))

187 return(x);

188 #endif

221 e = (NBITS -1) - e;

222 /* clean out 16 bits at a time */

223 while( e >= 16 )

224 {

225 #ifdef IBMPC

lgammaf.c (https://github.com/ziglang/zig.git) C · 187 lines

52

53 #ifdef INFINITIES

54 if (!isfinite(x))

55 return (INFINITY);

56 #endif

98 if (x >= 1.5)

99 {

100 while (tx > 2.5)

101 {

102 nx -= 1.0;

123 goto contz;

124 }

125 while (tx < 1.5)

126 {

127 if (tx == 0.0)

lgammaf.c (git://pkgs.fedoraproject.org/mingw-crt) C · 189 lines

52

53 #ifdef INFINITIES

54 if (!isfinite(x))

55 return (x);

56 #endif

98 if (x >= 1.5)

99 {

100 while (tx > 2.5)

101 {

102 nx -= 1.0;

123 goto contz;

124 }

125 while (tx < 1.5)

126 {

127 if (tx == 0.0)

grisu.jl (https://github.com/SinSiXX/julia.git) Lisp · 182 lines

28 # wrapper for the core grisu function, primarily for debugging

29 function grisu(x::Float64, mode::Integer, ndigits::Integer)

30 if !isfinite(x); error("non-finite value: $x"); end

31 if ndigits < 0; error("negative digits requested"); end

32 @grisu_ccall x mode ndigits

68 pt = int(POINT[1])

69 if mode == PRECISION

70 while len > 1 && DIGITS[len] == '0'

71 len -= 1

72 end

89 # => 0.00########

90 write(io, "0.")

91 while pt < 0

92 write(io, '0')

93 pt += 1

tgammaf.c (git://pkgs.fedoraproject.org/mingw-w64-tools) C · 195 lines

79 return (NANF);

80 #else

81 if (!isfinite(x))

82 return (x);

83 #endif

136 direction = 0;

137 z = 1.0;

138 while (x >= 3.0)

139 {

140 x -= 1.0;

142 }

143 /*

144 while (x < 0.0)

145 {

146 if (x > -1.E-4)

bug1868543.js (https://github.com/Microsoft/ChakraCore.git) JavaScript · 35 lines

6 var ary = new Array(10);

7 var e = -6;

8 function makeArrayLength(x) { if (x < 1 || x > 4294967295 || x != x || isNaN(x) || !isFinite(x)) return 100; else return Math.floor(x) & 0xffff; };;

9 var func3 = function (argStr4, argArr5, argArr6) {

10 var re1 = /ab[b7]ba/m;

18 arrObj0.prop0 = (((argArr5.reverse()) instanceof ((typeof Boolean == 'function') ? Boolean : Object)) << (argArr6[(((arrObj0.prop0 >= 0 ? arrObj0.prop0 : 0)) & 0XF)] + i8[(18) & 255]));

19 obj1.length = makeArrayLength(undefined);

20 } while (((argArr5[(loopInvariant)] * ary[((((argArr6[(((arrObj0.prop0 >= 0 ? arrObj0.prop0 : 0)) & 0XF)] + i8[(18) & 255]) >= 0 ? (argArr6[(((arrObj0.prop0 >= 0 ? arrObj0.prop0 : 0)) & 0XF)] + i8[(18) & 255]) : 0)) & 0XF)] + ((obj1.prop1 !== e) || (arrObj0.prop0 != obj1.length)))))

21 return (5 in arrObj0);

22 };

test122.js (https://github.com/Microsoft/ChakraCore.git) JavaScript · 35 lines

5

6 function test0() {

7 function makeArrayLength(x) { if(x < 1 || x > 4294967295 || x != x || isNaN(x) || !isFinite(x)) return 100; else return Math.floor(x) & 0xffff; };;

8 var obj0 = {};

9 var arrObj0 = {};

25 var w = e;

26 }

27 } while((1) && __loopvar1 < 3)

28 e *= arrObj0.prop0;

29 }

typ.js (http://story-steward.googlecode.com/svn/trunk/) JavaScript · 489 lines

248

249 function hasErrorProto(obj) {

250 while (obj && (obj !== OBJECT_PROTOTYPE)) {

251 if (obj === ERROR_PROTOTYPE) {

252 return true;

310

311 function isInt(x) {

312 if (!isNumber(x) || (x !== Math.floor(x)) || !isFinite(x)) {

313 return false;

314 }

floor.c (https://github.com/nearform/node-cephes.git) C · 398 lines

118 #endif

119 #ifdef INFINITIES

120 if (!isfinite(x))

121 return (x);

122 #endif

157 #endif

158 #ifdef INFINITIES

159 if (!isfinite(x))

160 return (x);

161 #endif

193 e = (NBITS - 1) - e;

194 /* clean out 16 bits at a time */

195 while (e >= 16) {

196 #ifdef IBMPC

197 *p++ = 0;

e.c (https://github.com/casey/e.git) C · 297 lines

17 if(arg != argc) c = *p++; else c = 0;

18 }

19 while(c == ' ');

20 }

21

25 char *t = argv[g];

26

27 while(1)

28 {

29 if(t == p) tc = c;

65 type r = 0;

66

67 while(c >= '0' && c <= '9')

68 { r = 10*r + (c-'0'); next(); }

69

download.jl (https://github.com/fredrikekre/HTTP.jl.git) Julia · 142 lines

91 function download(url::AbstractString, local_path=nothing, headers=Header[]; update_period=1, kw...)

92 format_progress(x) = round(x, digits=4)

93 format_bytes(x) = !isfinite(x) ? "∞ B" : Base.format_bytes(x)

94 format_seconds(x) = "$(round(x; digits=2)) s"

95 format_bytes_per_second(x) = format_bytes(x) * "/s"

128

129 Base.open(file, "w") do fh

130 while(!eof(stream))

131 downloaded_bytes += write(fh, readavailable(stream))

132 if now() - prev_time > Millisecond(1000update_period)

Numbers.js (https://github.com/bigfix/protovis.git) JavaScript · 312 lines

24 var array = [], i = 0, j;

25 if (step < 0) {

26 while ((j = start + step * i++) > stop) {

27 array.push(j);

28 }

29 } else {

30 while ((j = start + step * i++) < stop) {

31 array.push(j);

32 }

265 */

266 pv.logAdjusted = function(x, b) {

267 if (!isFinite(x)) return x;

268 var negative = x < 0;

269 if (x < b) x += (b - x) / b;

grisu.jl (https://github.com/biegelk/julia.git) Lisp · 165 lines

30 global grisu, grisu_fix, grisu_sig

31 function grisu(x::Float64, mode::Integer, ndigits::Integer)

32 if !isfinite(x); error("non-finite value: $x"); end

33 if ndigits < 0; error("negative digits requested"); end

34 @grisu_ccall x mode ndigits

58 pt = POINT[1]

59 if mode == PRECISION

60 while len > 1 && DIGITS[len] == '0'

61 len -= 1

62 end

79 # => 0.00########

80 write(io, "0.")

81 while pt < 0

82 write(io, '0')

83 pt += 1

pike_float.h (git://github.com/pikelang/Pike.git) C Header · 91 lines

34 #define PIKE_ISINF(X) isinf(X)

35 #elif defined(HAVE_ISFINITE)

36 #define PIKE_ISINF(X) (!isfinite(X))

37 #elif defined(HAVE__FINITE)

38 #define PIKE_ISINF(X) (!_finite(X))

match.c (https://github.com/nclack/whisk.git) C · 543 lines

32

33 #ifndef isinf

34 #define isinf(x) (!isfinite(x))

35 #endif

36

99

100 distMatrixTemp = distMatrix;

101 while(distMatrixTemp < distMatrixEnd)

102 {

103 value = *distMatrixTemp++;

121 infValue = 10;

122 distMatrixTemp = distMatrix;

123 while(distMatrixTemp < distMatrixEnd)

124 if(isinf(*distMatrixTemp++))

125 *(distMatrixTemp-1) = infValue;

Astro 585 Lab 1 Ford.py (https://github.com/benelson/Astro585-1.git) Python · 248 lines

209

210 function round_down_to_power_of_ten(x::Real)

211 if(!isfinite(x))

212 if(isnan(x)) return nan(x) end

213 if(isinf(x)) return x end

216 z = 1.0;

217 if x >= 1.0;

218 while z*10.<=x

219 z = z * 10.0;

220 end

221 else

222 while z > x # correct

223 z = z / 10.0;

224 end

cprob.patch (https://github.com/ychaim/qml.git) Patch · 182 lines

56 +#ifndef NO_MTHERR

57 +extern double NAN; /* defined in const.c */

58 +#define mtherr(name, code) do { return NAN; } while (0)

59 #endif

60

103 return(NAN);

104 #else

105 -if( !isfinite(x) )

106 +if( x == INFINITY || x == -INFINITY )

107 return(x);

120

121 #ifdef INFINITIES

122 -if( !isfinite(x) )

123 +if( x == INFINITY || x == -INFINITY )

124 return(INFINITY);

Float.java (https://github.com/scalagwt/google-web-toolkit-svnmirror.git) Java · 255 lines

123 // leading 1

124 exp = 1;

125 while ((bits & 0x800000) == 0) {

126 bits <<= 1;

127 exp--;

138

139 public static native boolean isInfinite(float x) /*-{

140 return !isFinite(x);

141 }-*/;

142

tgammaf.c (https://github.com/scottt/cygwin-vmci-sockets.git) C · 265 lines

149 return(NANF);

150 #else

151 if( !isfinite(x) )

152 return(x);

153 #endif

206 direction = 0;

207 z = 1.0;

208 while( x >= 3.0 )

209 {

210 x -= 1.0;

212 }

213 /*

214 while( x < 0.0 )

215 {

216 if( x > -1.E-4 )

grisu.jl (https://github.com/cloudchamber/julia.git) Lisp · 157 lines

25 global grisu, grisu_fix, grisu_sig

26 function grisu(x::Float64, mode::Integer, ndigits::Integer)

27 if !isfinite(x); error("non-finite value: $x"); end

28 if ndigits < 0; error("negative digits requested"); end

29 @grisu_ccall x mode ndigits

53 pt = _jl_point[1]

54 if mode == GRISU_PRECISION

55 while len > 1 && _jl_digits[len] == '0'

56 len -= 1

57 end

74 # => 0.00########

75 write(io, "0.")

76 while pt < 0

77 write(io, '0')

78 pt += 1

exp.jl (https://github.com/JuliaLang/julia.git) Julia · 236 lines

32 buf[pos + 2] = UInt8('N')

33 return pos + 3

34 elseif !isfinite(x)

35 buf[pos] = UInt8('I')

36 buf[pos + 1] = UInt8('n')

61 len = lengthforindex(idx)

62 i = len - 1

63 while i >= 0

64 j = p10bits - e2

65 #=@inbounds=# mula, mulb, mulc = POW10_SPLIT[POW10_OFFSET[idx + 1] + i + 1]

97 idx = div(-e2, 16)

98 i = MIN_BLOCK_2[idx + 1]

99 while i < 200

100 j = 120 + (-e2 - 16 * idx)

101 p = POW10_OFFSET_2[idx + 1] + i - MIN_BLOCK_2[idx + 1]

rational.jl (https://github.com/cyrilmhansen/julia.git) Lisp · 197 lines

48 function convert{T<:Integer}(::Type{Rational{T}}, x::FloatingPoint)

49 x == 0 && return zero(T)//one(T)

50 if !isfinite(x)

51 x < 0 && return -one(T)//zero(T)

52 x > 0 && return +one(T)//zero(T)

81 a = d = 1

82 b = c = 0

83 while true

84 f = itrunc(y); y -= f

85 p, q = f*a+c, f*b+d

fixed.jl (https://github.com/JuliaLang/julia.git) Julia · 182 lines

28 buf[pos + 2] = UInt8('N')

29 return pos + 3

30 elseif !isfinite(x)

31 buf[pos] = UInt8('I')

32 buf[pos + 1] = UInt8('n')

52 len = lengthforindex(idx)

53 i = len - 1

54 while i >= 0

55 j = p10bits - e2

56 #=@inbounds=# mula, mulb, mulc = POW10_SPLIT[POW10_OFFSET[idx + 1] + i + 1]

94 end

95 end

96 while i < blocks

97 j = 120 + (-e2 - 16 * idx)

98 p = POW10_OFFSET_2[idx + 1] + UInt32(i) - MIN_BLOCK_2[idx + 1]

shortest.jl (https://github.com/JuliaLang/julia.git) Julia · 494 lines

94 if a_allzero || b_allzero

95 # a) slow loop

96 while true

97 c_div10 = div(c, 10)

98 a_div10 = div(a, 10)

112 end

113 if a_allzero

114 while true

115 a_div10 = div(a, 10)

116 a_mod10 = (a % UInt32) - UInt32(10) * (a_div10 % UInt32)

147 e10 += 2

148 end

149 while true

150 c_div10 = div(c, 10)

151 a_div10 = div(a, 10)

grisu.jl (https://github.com/stevengj/julia.git) Julia · 165 lines

28 # wrapper for the core grisu function, primarily for debugging

29 function grisu(x::Float64, mode::Integer, ndigits::Integer)

30 if !isfinite(x); error("non-finite value: $x"); end

31 if ndigits < 0; error("negative digits requested"); end

32 @grisu_ccall x mode ndigits

60 pt = POINT[1]

61 if mode == PRECISION

62 while len > 1 && DIGITS[len] == '0'

63 len -= 1

64 end

80 # => 0.00########

81 write(io, "0.")

82 while pt < 0

83 write(io, '0')

84 pt += 1

helper_functions.hpp (https://bitbucket.org/claudio_ortega/fcnd-controls-cpp.git) C++ Header · 41 lines

18 {

19 #if defined (__PX4_NUTTX) || defined (__PX4_QURT)

20 if (!isfinite(x)) {

21 #else

22 if (!std::isfinite(x)) {

25 }

26

27 while (x >= (Type)M_PI) {

28 x -= (Type)(2.0 * M_PI);

29

30 }

31

32 while (x < (Type)(-M_PI)) {

33 x += (Type)(2.0 * M_PI);

34