Skip to content

Instantly share code, notes, and snippets.

@ebertmi
Created June 4, 2014 09:03
Show Gist options
  • Save ebertmi/ec645520cc9893604ce6 to your computer and use it in GitHub Desktop.
Save ebertmi/ec645520cc9893604ce6 to your computer and use it in GitHub Desktop.
Zerodivision skulpt test with default value
-----
from math import *
def differentiate(f, method, h=1.0E-5):
#h = float(h) # Ganzzahldivision vermeiden (in Python < 3.0.0)
if method == 'Forward1':
def Forward1(x):
return (f(x+h) - f(x)) / h
return Forward1
elif method == 'Backward1':
def Backward1(x):
return (f(x) - f(x-h)) / h
return Backward1
mycos = differentiate(sin, 'Forward1')
mysin = differentiate(mycos, 'Forward1')
x = pi
print mycos(x), cos(x), mysin(x), -sin(x)
-----
/* 1 */ var $scope0 = (function($modname) {
/* 2 */ var $gbl = {};
/* 3 */ if (Sk.retainGlobals) {
/* 4 */ if (Sk.globals) {
/* 5 */ $gbl = Sk.globals;
/* 6 */ Sk.globals = $gbl
/* 7 */ } else {
/* 8 */ Sk.globals = $gbl;
/* 9 */ }
/* 10 */ } else {
/* 11 */ Sk.globals = $gbl;
/* 12 */ }
/* 13 */ var $blk = 0,
/* 14 */ $exc = [],
/* 15 */ $loc = $gbl,
/* 16 */ $err = undefined;
/* 17 */ $gbl.__name__ = $modname;
/* 18 */ try {
/* 19 */ while (true) {
/* 20 */ try {
/* 21 */ switch ($blk) {
/* 22 */ case 0:
/* 23 */ /* --- module entry --- */
/* 24 */ //
/* 25 */ // line 1:
/* 26 */ // from math import *
/* 27 */ // ^
/* 28 */ //
/* 29 */ Sk.currLineNo = 1;
/* 30 */ Sk.currColNo = 0
/* 31 */
/* 32 */
/* 33 */ Sk.currFilename = './zerodivtest.py';
/* 34 */
/* 35 */ var $module1 = Sk.builtin.__import__('math', $gbl, $loc, ['*']);
/* 36 */ Sk.importStar($module1, $loc, $gbl);
/* 37 */ //
/* 38 */ // line 3:
/* 39 */ // def differentiate(f, method, h=1.0E-5):
/* 40 */ // ^
/* 41 */ //
/* 42 */ Sk.currLineNo = 3;
/* 43 */ Sk.currColNo = 0
/* 44 */
/* 45 */
/* 46 */ Sk.currFilename = './zerodivtest.py';
/* 47 */
/* 48 */ $scope2.co_name = new Sk.builtins['str']('differentiate');
/* 49 */ $scope2.$defaults = [new Sk.builtin.nmber(0.00001, 'float')];
/* 50 */ $scope2.co_varnames = ['f', 'method', 'h'];
/* 51 */ var $funcobj30 = new Sk.builtins['function']($scope2, $gbl);
/* 52 */ $loc.differentiate = $funcobj30;
/* 53 */ //
/* 54 */ // line 14:
/* 55 */ // mycos = differentiate(sin, 'Forward1')
/* 56 */ // ^
/* 57 */ //
/* 58 */ Sk.currLineNo = 14;
/* 59 */ Sk.currColNo = 0
/* 60 */
/* 61 */
/* 62 */ Sk.currFilename = './zerodivtest.py';
/* 63 */
/* 64 */ var $loadname31 = $loc.differentiate !== undefined ? $loc.differentiate : Sk.misceval.loadname('differentiate', $gbl);
/* 65 */ var $loadname32 = $loc.sin !== undefined ? $loc.sin : Sk.misceval.loadname('sin', $gbl);
/* 66 */ var $str33 = new Sk.builtins['str']('Forward1');
/* 67 */ var $call34 = Sk.misceval.callsim($loadname31, $loadname32, $str33);
/* 68 */ //
/* 69 */ // line 14:
/* 70 */ // mycos = differentiate(sin, 'Forward1')
/* 71 */ // ^
/* 72 */ //
/* 73 */ Sk.currLineNo = 14;
/* 74 */ Sk.currColNo = 8
/* 75 */
/* 76 */
/* 77 */ Sk.currFilename = './zerodivtest.py';
/* 78 */
/* 79 */ $loc.mycos = $call34;
/* 80 */ //
/* 81 */ // line 15:
/* 82 */ // mysin = differentiate(mycos, 'Forward1')
/* 83 */ // ^
/* 84 */ //
/* 85 */ Sk.currLineNo = 15;
/* 86 */ Sk.currColNo = 0
/* 87 */
/* 88 */
/* 89 */ Sk.currFilename = './zerodivtest.py';
/* 90 */
/* 91 */ var $loadname35 = $loc.differentiate !== undefined ? $loc.differentiate : Sk.misceval.loadname('differentiate', $gbl);
/* 92 */ var $loadname36 = $loc.mycos !== undefined ? $loc.mycos : Sk.misceval.loadname('mycos', $gbl);
/* 93 */ var $str37 = new Sk.builtins['str']('Forward1');
/* 94 */ var $call38 = Sk.misceval.callsim($loadname35, $loadname36, $str37);
/* 95 */ //
/* 96 */ // line 15:
/* 97 */ // mysin = differentiate(mycos, 'Forward1')
/* 98 */ // ^
/* 99 */ //
/* 100 */ Sk.currLineNo = 15;
/* 101 */ Sk.currColNo = 8
/* 102 */
/* 103 */
/* 104 */ Sk.currFilename = './zerodivtest.py';
/* 105 */
/* 106 */ $loc.mysin = $call38;
/* 107 */ //
/* 108 */ // line 16:
/* 109 */ // x = pi
/* 110 */ // ^
/* 111 */ //
/* 112 */ Sk.currLineNo = 16;
/* 113 */ Sk.currColNo = 0
/* 114 */
/* 115 */
/* 116 */ Sk.currFilename = './zerodivtest.py';
/* 117 */
/* 118 */ var $loadname39 = $loc.pi !== undefined ? $loc.pi : Sk.misceval.loadname('pi', $gbl);
/* 119 */ $loc.x = $loadname39;
/* 120 */ //
/* 121 */ // line 17:
/* 122 */ // print mycos(x), cos(x), mysin(x), -sin(x)
/* 123 */ // ^
/* 124 */ //
/* 125 */ Sk.currLineNo = 17;
/* 126 */ Sk.currColNo = 0
/* 127 */
/* 128 */
/* 129 */ Sk.currFilename = './zerodivtest.py';
/* 130 */
/* 131 */ var $loadname40 = $loc.mycos !== undefined ? $loc.mycos : Sk.misceval.loadname('mycos', $gbl);
/* 132 */ var $loadname41 = $loc.x !== undefined ? $loc.x : Sk.misceval.loadname('x', $gbl);
/* 133 */ var $call42 = Sk.misceval.callsim($loadname40, $loadname41);
/* 134 */ //
/* 135 */ // line 17:
/* 136 */ // print mycos(x), cos(x), mysin(x), -sin(x)
/* 137 */ // ^
/* 138 */ //
/* 139 */ Sk.currLineNo = 17;
/* 140 */ Sk.currColNo = 6
/* 141 */
/* 142 */
/* 143 */ Sk.currFilename = './zerodivtest.py';
/* 144 */
/* 145 */ Sk.misceval.print_(new Sk.builtins['str']($call42).v);
/* 146 */ var $loadname43 = $loc.cos !== undefined ? $loc.cos : Sk.misceval.loadname('cos', $gbl);
/* 147 */ var $loadname44 = $loc.x !== undefined ? $loc.x : Sk.misceval.loadname('x', $gbl);
/* 148 */ var $call45 = Sk.misceval.callsim($loadname43, $loadname44);
/* 149 */ //
/* 150 */ // line 17:
/* 151 */ // print mycos(x), cos(x), mysin(x), -sin(x)
/* 152 */ // ^
/* 153 */ //
/* 154 */ Sk.currLineNo = 17;
/* 155 */ Sk.currColNo = 16
/* 156 */
/* 157 */
/* 158 */ Sk.currFilename = './zerodivtest.py';
/* 159 */
/* 160 */ Sk.misceval.print_(new Sk.builtins['str']($call45).v);
/* 161 */ var $loadname46 = $loc.mysin !== undefined ? $loc.mysin : Sk.misceval.loadname('mysin', $gbl);
/* 162 */ var $loadname47 = $loc.x !== undefined ? $loc.x : Sk.misceval.loadname('x', $gbl);
/* 163 */ var $call48 = Sk.misceval.callsim($loadname46, $loadname47);
/* 164 */ //
/* 165 */ // line 17:
/* 166 */ // print mycos(x), cos(x), mysin(x), -sin(x)
/* 167 */ // ^
/* 168 */ //
/* 169 */ Sk.currLineNo = 17;
/* 170 */ Sk.currColNo = 24
/* 171 */
/* 172 */
/* 173 */ Sk.currFilename = './zerodivtest.py';
/* 174 */
/* 175 */ Sk.misceval.print_(new Sk.builtins['str']($call48).v);
/* 176 */ var $loadname49 = $loc.sin !== undefined ? $loc.sin : Sk.misceval.loadname('sin', $gbl);
/* 177 */ var $loadname50 = $loc.x !== undefined ? $loc.x : Sk.misceval.loadname('x', $gbl);
/* 178 */ var $call51 = Sk.misceval.callsim($loadname49, $loadname50);
/* 179 */ //
/* 180 */ // line 17:
/* 181 */ // print mycos(x), cos(x), mysin(x), -sin(x)
/* 182 */ // ^
/* 183 */ //
/* 184 */ Sk.currLineNo = 17;
/* 185 */ Sk.currColNo = 35
/* 186 */
/* 187 */
/* 188 */ Sk.currFilename = './zerodivtest.py';
/* 189 */
/* 190 */ var $unaryop52 = Sk.abstr.numberUnaryOp($call51, 'USub');
/* 191 */ Sk.misceval.print_(new Sk.builtins['str']($unaryop52).v);
/* 192 */ Sk.misceval.print_("\n");
/* 193 */ return $loc;
/* 194 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 195 */ }
/* 196 */ } catch (err) {
/* 197 */ if ($exc.length > 0) {
/* 198 */ $err = err;
/* 199 */ $blk = $exc.pop();
/* 200 */ continue;
/* 201 */ } else {
/* 202 */ throw err;
/* 203 */ }
/* 204 */ }
/* 205 */ }
/* 206 */ } catch (err) {
/* 207 */ if (err instanceof Sk.builtin.SystemExit && !Sk.throwSystemExit) {
/* 208 */ Sk.misceval.print_(err.toString() + '\n');
/* 209 */ return $loc;
/* 210 */ } else {
/* 211 */ throw err;
/* 212 */ }
/* 213 */ }
/* 214 */ });
/* 215 */ var $scope2 = (function $differentiate3$(f, method, h) {
/* 216 */ // has cell
/* 217 */ var Backward1, Forward1; /* locals */
/* 218 */ var $blk = 0,
/* 219 */ $exc = [],
/* 220 */ $loc = {},
/* 221 */ $cell = {},
/* 222 */ $gbl = this,
/* 223 */ $err = undefined;
/* 224 */ $cell.f = f;
/* 225 */ $cell.h = h;
/* 226 */ Sk.builtin.pyCheckArgs("differentiate", arguments, 2, 3, false, false);
/* 227 */ if (h === undefined) h = $scope2.$defaults[0];
/* 228 */ while (true) {
/* 229 */ try {
/* 230 */ switch ($blk) {
/* 231 */ case 0:
/* 232 */ /* --- codeobj entry --- */
/* 233 */ if (method === undefined) {
/* 234 */ throw new Error('local variable \'method\' referenced before assignment');
/* 235 */ }
/* 236 */
/* 237 */ //
/* 238 */ // line 5:
/* 239 */ // if method == 'Forward1':
/* 240 */ // ^
/* 241 */ //
/* 242 */ Sk.currLineNo = 5;
/* 243 */ Sk.currColNo = 4
/* 244 */
/* 245 */
/* 246 */ Sk.currFilename = './zerodivtest.py';
/* 247 */
/* 248 */ if (method === undefined) {
/* 249 */ throw new Error('local variable \'method\' referenced before assignment');
/* 250 */ }
/* 251 */ var $compareres4 = null;
/* 252 */ var $str5 = new Sk.builtins['str']('Forward1');
/* 253 */ var $compare6 = Sk.builtin.bool(Sk.misceval.richCompareBool(method, $str5, 'Eq'));
/* 254 */ $compareres4 = $compare6;
/* 255 */ var $jfalse7 = ($compare6 === false || !Sk.misceval.isTrue($compare6));
/* 256 */ if (Sk.execStart === undefined) {
/* 257 */ Sk.execStart = new Date()
/* 258 */ }
/* 259 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 260 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 261 */ }
/* 262 */ if ($jfalse7) { /*test failed */
/* 263 */ $blk = 3;
/* 264 */ continue;
/* 265 */ }
/* 266 */ if (Sk.execStart === undefined) {
/* 267 */ Sk.execStart = new Date()
/* 268 */ }
/* 269 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 270 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 271 */ }
/* 272 */ $blk = 3; /* jump */
/* 273 */ continue;
/* 274 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 275 */ case 1:
/* 276 */ /* --- end of if --- */
/* 277 */ return Sk.builtin.none.none$;
/* 278 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 279 */ case 2:
/* 280 */ /* --- next branch of if --- */
/* 281 */ //
/* 282 */ // line 9:
/* 283 */ // elif method == 'Backward1':
/* 284 */ // ^
/* 285 */ //
/* 286 */ Sk.currLineNo = 9;
/* 287 */ Sk.currColNo = 9
/* 288 */
/* 289 */
/* 290 */ Sk.currFilename = './zerodivtest.py';
/* 291 */
/* 292 */ if (method === undefined) {
/* 293 */ throw new Error('local variable \'method\' referenced before assignment');
/* 294 */ }
/* 295 */ var $compareres17 = null;
/* 296 */ var $str18 = new Sk.builtins['str']('Backward1');
/* 297 */ var $compare19 = Sk.builtin.bool(Sk.misceval.richCompareBool(method, $str18, 'Eq'));
/* 298 */ $compareres17 = $compare19;
/* 299 */ var $jfalse20 = ($compare19 === false || !Sk.misceval.isTrue($compare19));
/* 300 */ if (Sk.execStart === undefined) {
/* 301 */ Sk.execStart = new Date()
/* 302 */ }
/* 303 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 304 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 305 */ }
/* 306 */ if ($jfalse20) { /*test failed */
/* 307 */ $blk = 6;
/* 308 */ continue;
/* 309 */ }
/* 310 */ if (Sk.execStart === undefined) {
/* 311 */ Sk.execStart = new Date()
/* 312 */ }
/* 313 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 314 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 315 */ }
/* 316 */ $blk = 6; /* jump */
/* 317 */ continue;
/* 318 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 319 */ case 3:
/* 320 */ /* --- done --- */
/* 321 */ var $jfalse8 = ($compareres4 === false || !Sk.misceval.isTrue($compareres4));
/* 322 */ if (Sk.execStart === undefined) {
/* 323 */ Sk.execStart = new Date()
/* 324 */ }
/* 325 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 326 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 327 */ }
/* 328 */ if ($jfalse8) { /*test failed */
/* 329 */ $blk = 2;
/* 330 */ continue;
/* 331 */ }
/* 332 */ //
/* 333 */ // line 6:
/* 334 */ // def Forward1(x):
/* 335 */ // ^
/* 336 */ //
/* 337 */ Sk.currLineNo = 6;
/* 338 */ Sk.currColNo = 8
/* 339 */
/* 340 */
/* 341 */ Sk.currFilename = './zerodivtest.py';
/* 342 */
/* 343 */ $scope9.co_name = new Sk.builtins['str']('Forward1');
/* 344 */ $scope9.co_varnames = ['x'];
/* 345 */ var $funcobj16 = new Sk.builtins['function']($scope9, $gbl, $cell);
/* 346 */ Forward1 = $funcobj16;
/* 347 */ //
/* 348 */ // line 8:
/* 349 */ // return Forward1
/* 350 */ // ^
/* 351 */ //
/* 352 */ Sk.currLineNo = 8;
/* 353 */ Sk.currColNo = 8
/* 354 */
/* 355 */
/* 356 */ Sk.currFilename = './zerodivtest.py';
/* 357 */
/* 358 */ if (Forward1 === undefined) {
/* 359 */ throw new Error('local variable \'Forward1\' referenced before assignment');
/* 360 */ }
/* 361 */ return Forward1;
/* 362 */ if (Sk.execStart === undefined) {
/* 363 */ Sk.execStart = new Date()
/* 364 */ }
/* 365 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 366 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 367 */ }
/* 368 */ $blk = 1; /* jump */
/* 369 */ continue;
/* 370 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 371 */ case 4:
/* 372 */ /* --- end of if --- */
/* 373 */ if (Sk.execStart === undefined) {
/* 374 */ Sk.execStart = new Date()
/* 375 */ }
/* 376 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 377 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 378 */ }
/* 379 */ $blk = 1; /* jump */
/* 380 */ continue;
/* 381 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 382 */ case 5:
/* 383 */ /* --- next branch of if --- */
/* 384 */ if (Sk.execStart === undefined) {
/* 385 */ Sk.execStart = new Date()
/* 386 */ }
/* 387 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 388 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 389 */ }
/* 390 */ $blk = 4; /* jump */
/* 391 */ continue;
/* 392 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 393 */ case 6:
/* 394 */ /* --- done --- */
/* 395 */ var $jfalse21 = ($compareres17 === false || !Sk.misceval.isTrue($compareres17));
/* 396 */ if (Sk.execStart === undefined) {
/* 397 */ Sk.execStart = new Date()
/* 398 */ }
/* 399 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 400 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 401 */ }
/* 402 */ if ($jfalse21) { /*test failed */
/* 403 */ $blk = 5;
/* 404 */ continue;
/* 405 */ }
/* 406 */ //
/* 407 */ // line 10:
/* 408 */ // def Backward1(x):
/* 409 */ // ^
/* 410 */ //
/* 411 */ Sk.currLineNo = 10;
/* 412 */ Sk.currColNo = 8
/* 413 */
/* 414 */
/* 415 */ Sk.currFilename = './zerodivtest.py';
/* 416 */
/* 417 */ $scope22.co_name = new Sk.builtins['str']('Backward1');
/* 418 */ $scope22.co_varnames = ['x'];
/* 419 */ var $funcobj29 = new Sk.builtins['function']($scope22, $gbl, $cell);
/* 420 */ Backward1 = $funcobj29;
/* 421 */ //
/* 422 */ // line 12:
/* 423 */ // return Backward1
/* 424 */ // ^
/* 425 */ //
/* 426 */ Sk.currLineNo = 12;
/* 427 */ Sk.currColNo = 8
/* 428 */
/* 429 */
/* 430 */ Sk.currFilename = './zerodivtest.py';
/* 431 */
/* 432 */ if (Backward1 === undefined) {
/* 433 */ throw new Error('local variable \'Backward1\' referenced before assignment');
/* 434 */ }
/* 435 */ return Backward1;
/* 436 */ if (Sk.execStart === undefined) {
/* 437 */ Sk.execStart = new Date()
/* 438 */ }
/* 439 */ if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {
/* 440 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 441 */ }
/* 442 */ $blk = 4; /* jump */
/* 443 */ continue;
/* 444 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 445 */ }
/* 446 */ } catch (err) {
/* 447 */ if ($exc.length > 0) {
/* 448 */ $err = err;
/* 449 */ $blk = $exc.pop();
/* 450 */ continue;
/* 451 */ } else {
/* 452 */ throw err;
/* 453 */ }
/* 454 */ }
/* 455 */ }
/* 456 */ });
/* 457 */ var $scope9 = (function $Forward110$(x, $free) {
/* 458 */ // has free
/* 459 */ var $blk = 0,
/* 460 */ $exc = [],
/* 461 */ $loc = {},
/* 462 */ $gbl = this,
/* 463 */ $err = undefined;
/* 464 */ Sk.builtin.pyCheckArgs("Forward1", arguments, 1, 1, false, true);
/* 465 */ while (true) {
/* 466 */ try {
/* 467 */ switch ($blk) {
/* 468 */ case 0:
/* 469 */ /* --- codeobj entry --- */
/* 470 */ if (x === undefined) {
/* 471 */ throw new Error('local variable \'x\' referenced before assignment');
/* 472 */ }
/* 473 */
/* 474 */ //
/* 475 */ // line 7:
/* 476 */ // return (f(x+h) - f(x)) / h
/* 477 */ // ^
/* 478 */ //
/* 479 */ Sk.currLineNo = 7;
/* 480 */ Sk.currColNo = 12
/* 481 */
/* 482 */
/* 483 */ Sk.currFilename = './zerodivtest.py';
/* 484 */
/* 485 */ if (x === undefined) {
/* 486 */ throw new Error('local variable \'x\' referenced before assignment');
/* 487 */ }
/* 488 */ var $binop11 = Sk.abstr.numberBinOp(x, $free.h, 'Add');
/* 489 */ var $call12 = Sk.misceval.callsim($free.f, $binop11);
/* 490 */ //
/* 491 */ // line 7:
/* 492 */ // return (f(x+h) - f(x)) / h
/* 493 */ // ^
/* 494 */ //
/* 495 */ Sk.currLineNo = 7;
/* 496 */ Sk.currColNo = 20
/* 497 */
/* 498 */
/* 499 */ Sk.currFilename = './zerodivtest.py';
/* 500 */
/* 501 */ if (x === undefined) {
/* 502 */ throw new Error('local variable \'x\' referenced before assignment');
/* 503 */ }
/* 504 */ var $call13 = Sk.misceval.callsim($free.f, x);
/* 505 */ //
/* 506 */ // line 7:
/* 507 */ // return (f(x+h) - f(x)) / h
/* 508 */ // ^
/* 509 */ //
/* 510 */ Sk.currLineNo = 7;
/* 511 */ Sk.currColNo = 29
/* 512 */
/* 513 */
/* 514 */ Sk.currFilename = './zerodivtest.py';
/* 515 */
/* 516 */ var $binop14 = Sk.abstr.numberBinOp($call12, $call13, 'Sub');
/* 517 */ var $binop15 = Sk.abstr.numberBinOp($binop14, $free.h, 'Div');
/* 518 */ return $binop15;
/* 519 */ return Sk.builtin.none.none$;
/* 520 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 521 */ }
/* 522 */ } catch (err) {
/* 523 */ if ($exc.length > 0) {
/* 524 */ $err = err;
/* 525 */ $blk = $exc.pop();
/* 526 */ continue;
/* 527 */ } else {
/* 528 */ throw err;
/* 529 */ }
/* 530 */ }
/* 531 */ }
/* 532 */ });
/* 533 */ var $scope22 = (function $Backward123$(x, $free) {
/* 534 */ // has free
/* 535 */ var $blk = 0,
/* 536 */ $exc = [],
/* 537 */ $loc = {},
/* 538 */ $gbl = this,
/* 539 */ $err = undefined;
/* 540 */ Sk.builtin.pyCheckArgs("Backward1", arguments, 1, 1, false, true);
/* 541 */ while (true) {
/* 542 */ try {
/* 543 */ switch ($blk) {
/* 544 */ case 0:
/* 545 */ /* --- codeobj entry --- */
/* 546 */ if (x === undefined) {
/* 547 */ throw new Error('local variable \'x\' referenced before assignment');
/* 548 */ }
/* 549 */
/* 550 */ //
/* 551 */ // line 11:
/* 552 */ // return (f(x) - f(x-h)) / h
/* 553 */ // ^
/* 554 */ //
/* 555 */ Sk.currLineNo = 11;
/* 556 */ Sk.currColNo = 12
/* 557 */
/* 558 */
/* 559 */ Sk.currFilename = './zerodivtest.py';
/* 560 */
/* 561 */ if (x === undefined) {
/* 562 */ throw new Error('local variable \'x\' referenced before assignment');
/* 563 */ }
/* 564 */ var $call24 = Sk.misceval.callsim($free.f, x);
/* 565 */ //
/* 566 */ // line 11:
/* 567 */ // return (f(x) - f(x-h)) / h
/* 568 */ // ^
/* 569 */ //
/* 570 */ Sk.currLineNo = 11;
/* 571 */ Sk.currColNo = 20
/* 572 */
/* 573 */
/* 574 */ Sk.currFilename = './zerodivtest.py';
/* 575 */
/* 576 */ if (x === undefined) {
/* 577 */ throw new Error('local variable \'x\' referenced before assignment');
/* 578 */ }
/* 579 */ var $binop25 = Sk.abstr.numberBinOp(x, $free.h, 'Sub');
/* 580 */ var $call26 = Sk.misceval.callsim($free.f, $binop25);
/* 581 */ //
/* 582 */ // line 11:
/* 583 */ // return (f(x) - f(x-h)) / h
/* 584 */ // ^
/* 585 */ //
/* 586 */ Sk.currLineNo = 11;
/* 587 */ Sk.currColNo = 27
/* 588 */
/* 589 */
/* 590 */ Sk.currFilename = './zerodivtest.py';
/* 591 */
/* 592 */ var $binop27 = Sk.abstr.numberBinOp($call24, $call26, 'Sub');
/* 593 */ var $binop28 = Sk.abstr.numberBinOp($binop27, $free.h, 'Div');
/* 594 */ return $binop28;
/* 595 */ return Sk.builtin.none.none$;
/* 596 */ throw new Sk.builtin.SystemError('internal error: unterminated block');
/* 597 */ }
/* 598 */ } catch (err) {
/* 599 */ if ($exc.length > 0) {
/* 600 */ $err = err;
/* 601 */ $blk = $exc.pop();
/* 602 */ continue;
/* 603 */ } else {
/* 604 */ throw err;
/* 605 */ }
/* 606 */ }
/* 607 */ }
/* 608 */ });
mathjs not included and callable
Uncaught: "#<an Object>", [unnamed] line 211 column 25
/* 211 */ throw err;
^
dbg> (running)
<unknown>:10549: Uncaught NameError: Undefined variable in expression on line 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment