diff options
author | Rob Pike <r@golang.org> | 2008-07-08 17:26:10 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2008-07-08 17:26:10 -0700 |
commit | 86dbd84da0ae58a2510345b430ad21f6e8b8b7c4 (patch) | |
tree | 4d53e7f7d9c474e4796c90ea6685ccdf4e8ee6ff | |
parent | 16b495b639f3cf34ae6b32de343649785ceb5a06 (diff) | |
download | go-86dbd84da0ae58a2510345b430ad21f6e8b8b7c4.tar.gz |
fix ldexp, frexp, and make math package compile and test correctly
SVN=126423
-rw-r--r-- | src/cmd/gc/sys.go | 4 | ||||
-rw-r--r-- | src/cmd/gc/sysimport.c | 392 | ||||
-rw-r--r-- | src/lib/fmt.go | 2 | ||||
-rw-r--r-- | src/lib/math/exp.go | 2 | ||||
-rw-r--r-- | src/lib/math/fmod.go | 6 | ||||
-rw-r--r-- | src/lib/math/log.go | 2 | ||||
-rw-r--r-- | src/lib/math/main.go | 5 | ||||
-rw-r--r-- | src/lib/math/sqrt.go | 2 | ||||
-rw-r--r-- | src/runtime/runtime.c | 12 |
9 files changed, 213 insertions, 214 deletions
diff --git a/src/cmd/gc/sys.go b/src/cmd/gc/sys.go index d781cf825..f58a16128 100644 --- a/src/cmd/gc/sys.go +++ b/src/cmd/gc/sys.go @@ -28,8 +28,8 @@ func envc() int32; func argv(int32) string; func envv(int32) string; -func frexp(float64) (int32, float64); // break fp into exp,fract -func ldexp(int32, float64) float64; // make fp from exp,fract +func frexp(float64) (float64, int32); // break fp into exp,fract +func ldexp(float64, int32) float64; // make fp from exp,fract func modf(float64) (float64, float64); // break fp into double.double func isInf(float64, int32) bool; // test for infinity func isNaN(float64) bool; // test for not-a-number diff --git a/src/cmd/gc/sysimport.c b/src/cmd/gc/sysimport.c index fc4c6decc..9a87a8100 100644 --- a/src/cmd/gc/sysimport.c +++ b/src/cmd/gc/sysimport.c @@ -1,207 +1,207 @@ char* sysimport = "package sys\n" - "type sys._e002 {}\n" + "type sys._esys_002 {}\n" "type sys.any 24\n" - "type sys._e003 *sys.any\n" - "type sys._o262 {_e260 sys._e003}\n" + "type sys._esys_003 *sys.any\n" + "type sys._osys_262 {_esys_260 sys._esys_003}\n" "type sys.uint32 6\n" - "type sys._i264 {_e261 sys.uint32}\n" - "type sys._e001 (sys._e002 sys._o262 sys._i264)\n" - "var !sys.mal sys._e001\n" - "type sys._e005 {}\n" - "type sys._e006 {}\n" - "type sys._e007 {}\n" - "type sys._e004 (sys._e005 sys._e006 sys._e007)\n" - "var !sys.breakpoint sys._e004\n" - "type sys._e009 {}\n" - "type sys._e010 {}\n" + "type sys._isys_264 {_esys_261 sys.uint32}\n" + "type sys._esys_001 (sys._esys_002 sys._osys_262 sys._isys_264)\n" + "var !sys.mal sys._esys_001\n" + "type sys._esys_005 {}\n" + "type sys._esys_006 {}\n" + "type sys._esys_007 {}\n" + "type sys._esys_004 (sys._esys_005 sys._esys_006 sys._esys_007)\n" + "var !sys.breakpoint sys._esys_004\n" + "type sys._esys_009 {}\n" + "type sys._esys_010 {}\n" "type sys.int32 5\n" - "type sys._i270 {_e269 sys.int32}\n" - "type sys._e008 (sys._e009 sys._e010 sys._i270)\n" - "var !sys.panicl sys._e008\n" - "type sys._e012 {}\n" - "type sys._e013 {}\n" + "type sys._isys_270 {_esys_269 sys.int32}\n" + "type sys._esys_008 (sys._esys_009 sys._esys_010 sys._isys_270)\n" + "var !sys.panicl sys._esys_008\n" + "type sys._esys_012 {}\n" + "type sys._esys_013 {}\n" "type sys.bool 12\n" - "type sys._i275 {_e274 sys.bool}\n" - "type sys._e011 (sys._e012 sys._e013 sys._i275)\n" - "var !sys.printbool sys._e011\n" - "type sys._e015 {}\n" - "type sys._e016 {}\n" + "type sys._isys_275 {_esys_274 sys.bool}\n" + "type sys._esys_011 (sys._esys_012 sys._esys_013 sys._isys_275)\n" + "var !sys.printbool sys._esys_011\n" + "type sys._esys_015 {}\n" + "type sys._esys_016 {}\n" "type sys.float64 10\n" - "type sys._i280 {_e279 sys.float64}\n" - "type sys._e014 (sys._e015 sys._e016 sys._i280)\n" - "var !sys.printfloat sys._e014\n" - "type sys._e018 {}\n" - "type sys._e019 {}\n" + "type sys._isys_280 {_esys_279 sys.float64}\n" + "type sys._esys_014 (sys._esys_015 sys._esys_016 sys._isys_280)\n" + "var !sys.printfloat sys._esys_014\n" + "type sys._esys_018 {}\n" + "type sys._esys_019 {}\n" "type sys.int64 7\n" - "type sys._i285 {_e284 sys.int64}\n" - "type sys._e017 (sys._e018 sys._e019 sys._i285)\n" - "var !sys.printint sys._e017\n" - "type sys._e021 {}\n" - "type sys._e022 {}\n" - "type sys._e023 25\n" - "type sys.string *sys._e023\n" - "type sys._i290 {_e289 sys.string}\n" - "type sys._e020 (sys._e021 sys._e022 sys._i290)\n" - "var !sys.printstring sys._e020\n" - "type sys._e025 {}\n" - "type sys._e026 {}\n" + "type sys._isys_285 {_esys_284 sys.int64}\n" + "type sys._esys_017 (sys._esys_018 sys._esys_019 sys._isys_285)\n" + "var !sys.printint sys._esys_017\n" + "type sys._esys_021 {}\n" + "type sys._esys_022 {}\n" + "type sys._esys_023 25\n" + "type sys.string *sys._esys_023\n" + "type sys._isys_290 {_esys_289 sys.string}\n" + "type sys._esys_020 (sys._esys_021 sys._esys_022 sys._isys_290)\n" + "var !sys.printstring sys._esys_020\n" + "type sys._esys_025 {}\n" + "type sys._esys_026 {}\n" "type sys.uint8 2\n" - "type sys._e027 *sys.uint8\n" - "type sys._i295 {_e294 sys._e027}\n" - "type sys._e024 (sys._e025 sys._e026 sys._i295)\n" - "var !sys.printpointer sys._e024\n" - "type sys._e029 {}\n" - "type sys._o302 {_e299 sys.string}\n" - "type sys._i304 {_e300 sys.string _e301 sys.string}\n" - "type sys._e028 (sys._e029 sys._o302 sys._i304)\n" - "var !sys.catstring sys._e028\n" - "type sys._e031 {}\n" - "type sys._o312 {_e309 sys.int32}\n" - "type sys._i314 {_e310 sys.string _e311 sys.string}\n" - "type sys._e030 (sys._e031 sys._o312 sys._i314)\n" - "var !sys.cmpstring sys._e030\n" - "type sys._e033 {}\n" - "type sys._o323 {_e319 sys.string}\n" - "type sys._i325 {_e320 sys.string _e321 sys.int32 _e322 sys.int32}\n" - "type sys._e032 (sys._e033 sys._o323 sys._i325)\n" - "var !sys.slicestring sys._e032\n" - "type sys._e035 {}\n" - "type sys._o334 {_e331 sys.uint8}\n" - "type sys._i336 {_e332 sys.string _e333 sys.int32}\n" - "type sys._e034 (sys._e035 sys._o334 sys._i336)\n" - "var !sys.indexstring sys._e034\n" - "type sys._e037 {}\n" - "type sys._o343 {_e341 sys.string}\n" - "type sys._i345 {_e342 sys.int64}\n" - "type sys._e036 (sys._e037 sys._o343 sys._i345)\n" - "var !sys.intstring sys._e036\n" - "type sys._e039 {}\n" - "type sys._o352 {_e349 sys.string}\n" - "type sys._e040 *sys.uint8\n" - "type sys._i354 {_e350 sys._e040 _e351 sys.int32}\n" - "type sys._e038 (sys._e039 sys._o352 sys._i354)\n" - "var !sys.byteastring sys._e038\n" - "type sys._e042 {}\n" - "type sys._e043 <>\n" - "type sys._o363 {_e359 sys._e043}\n" - "type sys._e044 *sys.uint8\n" - "type sys._e045 *sys.uint8\n" - "type sys._s370 {}\n" - "type sys._e046 *sys._s370\n" - "type sys._i365 {_e360 sys._e044 _e361 sys._e045 _e362 sys._e046}\n" - "type sys._e041 (sys._e042 sys._o363 sys._i365)\n" - "var !sys.mkiface sys._e041\n" - "type sys._e048 {}\n" - "type sys._o374 {_e373 sys.int32}\n" - "type sys._e049 {}\n" - "type sys._e047 (sys._e048 sys._o374 sys._e049)\n" - "var !sys.argc sys._e047\n" - "type sys._e051 {}\n" - "type sys._o378 {_e377 sys.int32}\n" - "type sys._e052 {}\n" - "type sys._e050 (sys._e051 sys._o378 sys._e052)\n" - "var !sys.envc sys._e050\n" - "type sys._e054 {}\n" - "type sys._o383 {_e381 sys.string}\n" - "type sys._i385 {_e382 sys.int32}\n" - "type sys._e053 (sys._e054 sys._o383 sys._i385)\n" - "var !sys.argv sys._e053\n" - "type sys._e056 {}\n" - "type sys._o391 {_e389 sys.string}\n" - "type sys._i393 {_e390 sys.int32}\n" - "type sys._e055 (sys._e056 sys._o391 sys._i393)\n" - "var !sys.envv sys._e055\n" - "type sys._e058 {}\n" - "type sys._o400 {_e397 sys.int32 _e398 sys.float64}\n" - "type sys._i402 {_e399 sys.float64}\n" - "type sys._e057 (sys._e058 sys._o400 sys._i402)\n" - "var !sys.frexp sys._e057\n" - "type sys._e060 {}\n" - "type sys._o409 {_e406 sys.float64}\n" - "type sys._i411 {_e407 sys.int32 _e408 sys.float64}\n" - "type sys._e059 (sys._e060 sys._o409 sys._i411)\n" - "var !sys.ldexp sys._e059\n" - "type sys._e062 {}\n" - "type sys._o419 {_e416 sys.float64 _e417 sys.float64}\n" - "type sys._i421 {_e418 sys.float64}\n" - "type sys._e061 (sys._e062 sys._o419 sys._i421)\n" - "var !sys.modf sys._e061\n" - "type sys._e064 {}\n" - "type sys._o428 {_e425 sys.bool}\n" - "type sys._i430 {_e426 sys.float64 _e427 sys.int32}\n" - "type sys._e063 (sys._e064 sys._o428 sys._i430)\n" - "var !sys.isInf sys._e063\n" - "type sys._e066 {}\n" - "type sys._o437 {_e435 sys.bool}\n" - "type sys._i439 {_e436 sys.float64}\n" - "type sys._e065 (sys._e066 sys._o437 sys._i439)\n" - "var !sys.isNaN sys._e065\n" - "type sys._e068 {}\n" - "type sys._o445 {_e443 sys.float64}\n" - "type sys._i447 {_e444 sys.int32}\n" - "type sys._e067 (sys._e068 sys._o445 sys._i447)\n" - "var !sys.Inf sys._e067\n" - "type sys._e070 {}\n" - "type sys._o452 {_e451 sys.float64}\n" - "type sys._e071 {}\n" - "type sys._e069 (sys._e070 sys._o452 sys._e071)\n" - "var !sys.NaN sys._e069\n" - "type sys._e073 {}\n" - "type sys._e075 [sys.any] sys.any\n" - "type sys._e074 *sys._e075\n" - "type sys._o455 {hmap sys._e074}\n" - "type sys._i457 {keysize sys.uint32 valsize sys.uint32 keyalg sys.uint32 valalg sys.uint32 hint sys.uint32}\n" - "type sys._e072 (sys._e073 sys._o455 sys._i457)\n" - "var !sys.newmap sys._e072\n" - "type sys._e077 {}\n" - "type sys._o466 {val sys.any}\n" - "type sys._e079 [sys.any] sys.any\n" - "type sys._e078 *sys._e079\n" - "type sys._i468 {hmap sys._e078 key sys.any}\n" - "type sys._e076 (sys._e077 sys._o466 sys._i468)\n" - "var !sys.mapaccess1 sys._e076\n" - "type sys._e081 {}\n" - "type sys._o474 {val sys.any pres sys.bool}\n" - "type sys._e083 [sys.any] sys.any\n" - "type sys._e082 *sys._e083\n" - "type sys._i476 {hmap sys._e082 key sys.any}\n" - "type sys._e080 (sys._e081 sys._o474 sys._i476)\n" - "var !sys.mapaccess2 sys._e080\n" - "type sys._e085 {}\n" - "type sys._e086 {}\n" - "type sys._e088 [sys.any] sys.any\n" - "type sys._e087 *sys._e088\n" - "type sys._i483 {hmap sys._e087 key sys.any val sys.any}\n" - "type sys._e084 (sys._e085 sys._e086 sys._i483)\n" - "var !sys.mapassign1 sys._e084\n" - "type sys._e090 {}\n" - "type sys._e091 {}\n" - "type sys._e093 [sys.any] sys.any\n" - "type sys._e092 *sys._e093\n" - "type sys._i489 {hmap sys._e092 key sys.any val sys.any pres sys.bool}\n" - "type sys._e089 (sys._e090 sys._e091 sys._i489)\n" - "var !sys.mapassign2 sys._e089\n" - "type sys._e095 {}\n" - "type sys._o499 {_e496 sys.string _e497 sys.bool}\n" - "type sys._i501 {_e498 sys.string}\n" - "type sys._e094 (sys._e095 sys._o499 sys._i501)\n" - "var !sys.readfile sys._e094\n" - "type sys._e097 {}\n" - "type sys._o510 {_e505 sys.int32 _e506 sys.int32}\n" - "type sys._e098 *sys.uint8\n" - "type sys._i512 {_e507 sys._e098 _e508 sys.int32 _e509 sys.int32}\n" - "type sys._e096 (sys._e097 sys._o510 sys._i512)\n" - "var !sys.bytestorune sys._e096\n" - "type sys._e100 {}\n" - "type sys._o523 {_e518 sys.int32 _e519 sys.int32}\n" - "type sys._i525 {_e520 sys.string _e521 sys.int32 _e522 sys.int32}\n" - "type sys._e099 (sys._e100 sys._o523 sys._i525)\n" - "var !sys.stringtorune sys._e099\n" - "type sys._e102 {}\n" - "type sys._e103 {}\n" - "type sys._i532 {_e531 sys.int32}\n" - "type sys._e101 (sys._e102 sys._e103 sys._i532)\n" - "var !sys.exit sys._e101\n" + "type sys._esys_027 *sys.uint8\n" + "type sys._isys_295 {_esys_294 sys._esys_027}\n" + "type sys._esys_024 (sys._esys_025 sys._esys_026 sys._isys_295)\n" + "var !sys.printpointer sys._esys_024\n" + "type sys._esys_029 {}\n" + "type sys._osys_302 {_esys_299 sys.string}\n" + "type sys._isys_304 {_esys_300 sys.string _esys_301 sys.string}\n" + "type sys._esys_028 (sys._esys_029 sys._osys_302 sys._isys_304)\n" + "var !sys.catstring sys._esys_028\n" + "type sys._esys_031 {}\n" + "type sys._osys_312 {_esys_309 sys.int32}\n" + "type sys._isys_314 {_esys_310 sys.string _esys_311 sys.string}\n" + "type sys._esys_030 (sys._esys_031 sys._osys_312 sys._isys_314)\n" + "var !sys.cmpstring sys._esys_030\n" + "type sys._esys_033 {}\n" + "type sys._osys_323 {_esys_319 sys.string}\n" + "type sys._isys_325 {_esys_320 sys.string _esys_321 sys.int32 _esys_322 sys.int32}\n" + "type sys._esys_032 (sys._esys_033 sys._osys_323 sys._isys_325)\n" + "var !sys.slicestring sys._esys_032\n" + "type sys._esys_035 {}\n" + "type sys._osys_334 {_esys_331 sys.uint8}\n" + "type sys._isys_336 {_esys_332 sys.string _esys_333 sys.int32}\n" + "type sys._esys_034 (sys._esys_035 sys._osys_334 sys._isys_336)\n" + "var !sys.indexstring sys._esys_034\n" + "type sys._esys_037 {}\n" + "type sys._osys_343 {_esys_341 sys.string}\n" + "type sys._isys_345 {_esys_342 sys.int64}\n" + "type sys._esys_036 (sys._esys_037 sys._osys_343 sys._isys_345)\n" + "var !sys.intstring sys._esys_036\n" + "type sys._esys_039 {}\n" + "type sys._osys_352 {_esys_349 sys.string}\n" + "type sys._esys_040 *sys.uint8\n" + "type sys._isys_354 {_esys_350 sys._esys_040 _esys_351 sys.int32}\n" + "type sys._esys_038 (sys._esys_039 sys._osys_352 sys._isys_354)\n" + "var !sys.byteastring sys._esys_038\n" + "type sys._esys_042 {}\n" + "type sys._esys_043 <>\n" + "type sys._osys_363 {_esys_359 sys._esys_043}\n" + "type sys._esys_044 *sys.uint8\n" + "type sys._esys_045 *sys.uint8\n" + "type sys._ssys_370 {}\n" + "type sys._esys_046 *sys._ssys_370\n" + "type sys._isys_365 {_esys_360 sys._esys_044 _esys_361 sys._esys_045 _esys_362 sys._esys_046}\n" + "type sys._esys_041 (sys._esys_042 sys._osys_363 sys._isys_365)\n" + "var !sys.mkiface sys._esys_041\n" + "type sys._esys_048 {}\n" + "type sys._osys_374 {_esys_373 sys.int32}\n" + "type sys._esys_049 {}\n" + "type sys._esys_047 (sys._esys_048 sys._osys_374 sys._esys_049)\n" + "var !sys.argc sys._esys_047\n" + "type sys._esys_051 {}\n" + "type sys._osys_378 {_esys_377 sys.int32}\n" + "type sys._esys_052 {}\n" + "type sys._esys_050 (sys._esys_051 sys._osys_378 sys._esys_052)\n" + "var !sys.envc sys._esys_050\n" + "type sys._esys_054 {}\n" + "type sys._osys_383 {_esys_381 sys.string}\n" + "type sys._isys_385 {_esys_382 sys.int32}\n" + "type sys._esys_053 (sys._esys_054 sys._osys_383 sys._isys_385)\n" + "var !sys.argv sys._esys_053\n" + "type sys._esys_056 {}\n" + "type sys._osys_391 {_esys_389 sys.string}\n" + "type sys._isys_393 {_esys_390 sys.int32}\n" + "type sys._esys_055 (sys._esys_056 sys._osys_391 sys._isys_393)\n" + "var !sys.envv sys._esys_055\n" + "type sys._esys_058 {}\n" + "type sys._osys_400 {_esys_397 sys.float64 _esys_398 sys.int32}\n" + "type sys._isys_402 {_esys_399 sys.float64}\n" + "type sys._esys_057 (sys._esys_058 sys._osys_400 sys._isys_402)\n" + "var !sys.frexp sys._esys_057\n" + "type sys._esys_060 {}\n" + "type sys._osys_409 {_esys_406 sys.float64}\n" + "type sys._isys_411 {_esys_407 sys.float64 _esys_408 sys.int32}\n" + "type sys._esys_059 (sys._esys_060 sys._osys_409 sys._isys_411)\n" + "var !sys.ldexp sys._esys_059\n" + "type sys._esys_062 {}\n" + "type sys._osys_419 {_esys_416 sys.float64 _esys_417 sys.float64}\n" + "type sys._isys_421 {_esys_418 sys.float64}\n" + "type sys._esys_061 (sys._esys_062 sys._osys_419 sys._isys_421)\n" + "var !sys.modf sys._esys_061\n" + "type sys._esys_064 {}\n" + "type sys._osys_428 {_esys_425 sys.bool}\n" + "type sys._isys_430 {_esys_426 sys.float64 _esys_427 sys.int32}\n" + "type sys._esys_063 (sys._esys_064 sys._osys_428 sys._isys_430)\n" + "var !sys.isInf sys._esys_063\n" + "type sys._esys_066 {}\n" + "type sys._osys_437 {_esys_435 sys.bool}\n" + "type sys._isys_439 {_esys_436 sys.float64}\n" + "type sys._esys_065 (sys._esys_066 sys._osys_437 sys._isys_439)\n" + "var !sys.isNaN sys._esys_065\n" + "type sys._esys_068 {}\n" + "type sys._osys_445 {_esys_443 sys.float64}\n" + "type sys._isys_447 {_esys_444 sys.int32}\n" + "type sys._esys_067 (sys._esys_068 sys._osys_445 sys._isys_447)\n" + "var !sys.Inf sys._esys_067\n" + "type sys._esys_070 {}\n" + "type sys._osys_452 {_esys_451 sys.float64}\n" + "type sys._esys_071 {}\n" + "type sys._esys_069 (sys._esys_070 sys._osys_452 sys._esys_071)\n" + "var !sys.NaN sys._esys_069\n" + "type sys._esys_073 {}\n" + "type sys._esys_075 [sys.any] sys.any\n" + "type sys._esys_074 *sys._esys_075\n" + "type sys._osys_455 {hmap sys._esys_074}\n" + "type sys._isys_457 {keysize sys.uint32 valsize sys.uint32 keyalg sys.uint32 valalg sys.uint32 hint sys.uint32}\n" + "type sys._esys_072 (sys._esys_073 sys._osys_455 sys._isys_457)\n" + "var !sys.newmap sys._esys_072\n" + "type sys._esys_077 {}\n" + "type sys._osys_466 {val sys.any}\n" + "type sys._esys_079 [sys.any] sys.any\n" + "type sys._esys_078 *sys._esys_079\n" + "type sys._isys_468 {hmap sys._esys_078 key sys.any}\n" + "type sys._esys_076 (sys._esys_077 sys._osys_466 sys._isys_468)\n" + "var !sys.mapaccess1 sys._esys_076\n" + "type sys._esys_081 {}\n" + "type sys._osys_474 {val sys.any pres sys.bool}\n" + "type sys._esys_083 [sys.any] sys.any\n" + "type sys._esys_082 *sys._esys_083\n" + "type sys._isys_476 {hmap sys._esys_082 key sys.any}\n" + "type sys._esys_080 (sys._esys_081 sys._osys_474 sys._isys_476)\n" + "var !sys.mapaccess2 sys._esys_080\n" + "type sys._esys_085 {}\n" + "type sys._esys_086 {}\n" + "type sys._esys_088 [sys.any] sys.any\n" + "type sys._esys_087 *sys._esys_088\n" + "type sys._isys_483 {hmap sys._esys_087 key sys.any val sys.any}\n" + "type sys._esys_084 (sys._esys_085 sys._esys_086 sys._isys_483)\n" + "var !sys.mapassign1 sys._esys_084\n" + "type sys._esys_090 {}\n" + "type sys._esys_091 {}\n" + "type sys._esys_093 [sys.any] sys.any\n" + "type sys._esys_092 *sys._esys_093\n" + "type sys._isys_489 {hmap sys._esys_092 key sys.any val sys.any pres sys.bool}\n" + "type sys._esys_089 (sys._esys_090 sys._esys_091 sys._isys_489)\n" + "var !sys.mapassign2 sys._esys_089\n" + "type sys._esys_095 {}\n" + "type sys._osys_499 {_esys_496 sys.string _esys_497 sys.bool}\n" + "type sys._isys_501 {_esys_498 sys.string}\n" + "type sys._esys_094 (sys._esys_095 sys._osys_499 sys._isys_501)\n" + "var !sys.readfile sys._esys_094\n" + "type sys._esys_097 {}\n" + "type sys._osys_510 {_esys_505 sys.int32 _esys_506 sys.int32}\n" + "type sys._esys_098 *sys.uint8\n" + "type sys._isys_512 {_esys_507 sys._esys_098 _esys_508 sys.int32 _esys_509 sys.int32}\n" + "type sys._esys_096 (sys._esys_097 sys._osys_510 sys._isys_512)\n" + "var !sys.bytestorune sys._esys_096\n" + "type sys._esys_100 {}\n" + "type sys._osys_523 {_esys_518 sys.int32 _esys_519 sys.int32}\n" + "type sys._isys_525 {_esys_520 sys.string _esys_521 sys.int32 _esys_522 sys.int32}\n" + "type sys._esys_099 (sys._esys_100 sys._osys_523 sys._isys_525)\n" + "var !sys.stringtorune sys._esys_099\n" + "type sys._esys_102 {}\n" + "type sys._esys_103 {}\n" + "type sys._isys_532 {_esys_531 sys.int32}\n" + "type sys._esys_101 (sys._esys_102 sys._esys_103 sys._isys_532)\n" + "var !sys.exit sys._esys_101\n" "))\n" ; diff --git a/src/lib/fmt.go b/src/lib/fmt.go index 30bc0a4f8..cc98462da 100644 --- a/src/lib/fmt.go +++ b/src/lib/fmt.go @@ -358,7 +358,7 @@ func unpack(a double) (negative bool, exp int, num double) { } // find g,e such that a = g*10^e. // guess 10-exponent using 2-exponent, then fine tune. - e2, g := sys.frexp(a); + g, e2 := sys.frexp(a); e := int(e2 * .301029995663981); g = a * pow10(-e); for g < 1 { diff --git a/src/lib/math/exp.go b/src/lib/math/exp.go index b428273e5..dc851a084 100644 --- a/src/lib/math/exp.go +++ b/src/lib/math/exp.go @@ -49,5 +49,5 @@ exp(arg double) double xsq = fract*fract; temp1 = ((p2*xsq+p1)*xsq+p0)*fract; temp2 = ((xsq+q2)*xsq+q1)*xsq + q0; - return sys.ldexp(ent, sqrt2*(temp2+temp1)/(temp2-temp1)); + return sys.ldexp(sqrt2*(temp2+temp1)/(temp2-temp1), ent); } diff --git a/src/lib/math/fmod.go b/src/lib/math/fmod.go index 4a5fe3b83..65222ac03 100644 --- a/src/lib/math/fmod.go +++ b/src/lib/math/fmod.go @@ -24,7 +24,7 @@ fmod(x, y double) double y = -y; } - yexp,yfr = sys.frexp(y); + yfr,yexp = sys.frexp(y); sign = false; if x < 0 { r = -x; @@ -34,11 +34,11 @@ fmod(x, y double) double } for r >= y { - rexp,rfr = sys.frexp(r); + rfr,rexp = sys.frexp(r); if rfr < yfr { rexp = rexp - 1; } - r = r - sys.ldexp(rexp-yexp, y); + r = r - sys.ldexp(y, rexp-yexp); } if sign { r = -r; diff --git a/src/lib/math/log.go b/src/lib/math/log.go index 7ad809cb0..96b3d9695 100644 --- a/src/lib/math/log.go +++ b/src/lib/math/log.go @@ -39,7 +39,7 @@ log(arg double) double return sys.NaN(); } - exp,x = sys.frexp(arg); + x,exp = sys.frexp(arg); for x < 0.5 { x = x*2; exp = exp-1; diff --git a/src/lib/math/main.go b/src/lib/math/main.go index e2277d29b..0006151d9 100644 --- a/src/lib/math/main.go +++ b/src/lib/math/main.go @@ -61,15 +61,14 @@ main() ck(exp[i], math.exp(f)); ck(floor[i], math.floor(f)); ck(log[i], math.log(math.fabs(f))); - math.pow(10, f); ck(pow[i], math.pow(10, f)); ck(sin[i], math.sin(f)); ck(sinh[i], math.sinh(f)); ck(sqrt[i], math.sqrt(math.fabs(f))); ck(tan[i], math.tan(f)); ck(tanh[i], math.tanh(f)); -// ck(math.fabs(tanh[i]*math.sqrt(2)), -// math.hypot(tanh[i], tanh[i])); + ck(math.fabs(tanh[i]*math.sqrt(2)), + math.hypot(tanh[i], tanh[i])); } } diff --git a/src/lib/math/sqrt.go b/src/lib/math/sqrt.go index c1a9e8622..4f8a8536d 100644 --- a/src/lib/math/sqrt.go +++ b/src/lib/math/sqrt.go @@ -30,7 +30,7 @@ sqrt(arg double) double return 0; } - exp,x = sys.frexp(arg); + x,exp = sys.frexp(arg); for x < 0.5 { x = x*2; exp = exp-1; diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 9d79fa531..ea6925d10 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -402,15 +402,15 @@ modf(float64 d, float64 *ip) * Keep the top 11+e bits; clear the rest. */ if(e <= 64-11) - x &= ~((uint64)1 << (64-11-e))-1; + x &= ~(((uint64)1 << (64LL-11LL-e))-1); dd = *(float64*)&x; *ip = dd; return d - dd; } -// func frexp(float64) (int32, float64); // break fp into exp,fract +// func frexp(float64) (float64, int32); // break fp into exp,fract void -sys·frexp(float64 din, int32 iou, float64 dou) +sys·frexp(float64 din, float64 dou, int32 iou) { dou = frexp(din, &iou); FLUSH(&dou); @@ -426,10 +426,10 @@ sys·ldexp(float64 din, int32 ein, float64 dou) //func modf(float64) (float64, float64); // break fp into double+double float64 -sys·modf(float64 din, float64 dou1, float64 dou2) +sys·modf(float64 din, float64 integer, float64 fraction) { - dou1 = modf(din, &dou2); - FLUSH(&dou2); + fraction = modf(din, &integer); + FLUSH(&fraction); } //func isinf(float64, int32 sign) bool; // test for infinity |