Anonymous | Login | 12-15-2019 03:23 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0006781 | [Squeak] Kernel | minor | always | 11-23-07 22:13 | 04-18-10 22:04 | ||||
Reporter | nicolas cellier | View Status | public | ||||||
Assigned To | andreas | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.10 | ||||||
Summary | 0006781: 0.0 raisedTo: -1.0 unexpected result | ||||||||
Description |
(0.0 raisedTo: -1) correctly raise a ZeroDivide while (0.0 raisedTo: -1.0) ... well, answer 0.0, hem... |
||||||||
Additional Information | |||||||||
Attached Files |
![]() ![]() ![]() ![]() ![]() ![]() |
||||||||
|
![]() |
|
(0011453 - 39 - 39 - 39 - 39 - 39 - 39) nicolas cellier 11-23-07 22:14 |
Sorry Ken, forgot to classify Kernel... |
(0011505 - 2010 - 3521 - 3521 - 3521 - 3521 - 3521) nicolas cellier 12-01-07 18:06 edited on: 12-01-07 18:29 |
Note: i checked what does C (libm.so.6) in these cases: pow(negativeZero,zero) -> 1.0 correct pow(0.0,0.0) -> 1.0 questionable could as well answer NaN or raise exception possible rationale: pow(-1.0/exp(100.0),0.0) will answer 1.0 so does pow(+1.0/exp(100.0),0.0) (there is no Float positiveZero) pow(zero,negativeZero) -> 1.0 could as well be a division by zero pow(negativeZero,0.5) -> 0.0 could as well be NaN (a negative number raised to non integer power) pow(negativeZero,1.0) -> -0.0 correct pow(nan,0.0) -> 1.0 possibly a bug of libm. Squeak does the same pow(0.0,nan) -> nan Here squeak does answer zero... pow(0.0,inf) -> 0.0 questionable could as well be nan pow(inf,0.0) -> 1.0 questionable could as well be nan Note that libm pow seems to also handle raisedToInteger: case... patch.1.cs does not exactly the same for negativeZero, so I upload patch.2.cs but this raise a lot of questions when pushing IEEE 754 logic to the borders... what is really in the standard anyway? #include <math.h> #include <stdio.h> int main() { double nz=-1.0/exp(1.0e100); double nan=0.0/0.0; double inf=exp(100.0); printf("1.0/-0.0=%f\n",1.0/nz); printf("pow(0.0,0.0)=%f\n",pow(0.0,0.0)); printf("pow(0.0,-0.0)=%f\n",pow(0.0,nz)); printf("pow(-0.0,0.0)=%f\n",pow(nz,0.0)); printf("pow(-0.0,0.5)=%f\n",pow(nz,0.5)); printf("pow(-0.0,1.0)=%f\n",pow(nz,1.0)); printf("pow(-1.0,0.5)=%f\n",pow(-1.0,0.5)); printf("pow(nan,0.0)=%f\n",pow(nan,0.0)); printf("pow(0.0,nan)=%f\n",pow(0.0,nan)); printf("pow(0.0,-1.0)=%f\n",pow(0.0,-1.0)); printf("pow(-0.0,-1.0)=%f\n",pow(nz,-1.0)); printf("pow(0.0,inf)=%f\n",pow(0.0,inf)); printf("pow(0.0,-inf)=%f\n",pow(0.0,-inf)); printf("pow(inf,0.0)=%f\n",pow(inf,0.0)); printf("pow(-inf,0.0)=%f\n",pow(-inf,0.0)); return 0; } |
(0011518 - 341 - 365 - 365 - 365 - 365 - 365) nicolas cellier 12-06-07 20:45 |
Number raisedTo: also has the bug. Since Float>>#raisedTo: is one of the not-relicenced method (though nothing more than 99% copy-paste from super), the best thing is to simply remove it and arrange for super to return a Float when it has to (using ^self class one). So pick NumberRaisedTo-M6781-nice-patch.2.cs and forget other patches. |
(0011558 - 179 - 245 - 245 - 245 - 245 - 245) Keith_Hodges 12-17-07 16:36 edited on: 12-17-07 17:08 |
"fix begin" Installer mantis bug: 6781 fix:'NumberRaisedTo-M6781-nice-patch.2.cs'. "fix test" Installer mantis bug: 6781 fix:'NumberRaisedTo-M6781-nice-test.1.cs'. "fix end" |
(0013334 - 59 - 59 - 209 - 209 - 209 - 209) nicolas cellier 10-04-09 20:05 |
Fixed in http://source.squeak.org/trunk/Kernel-nice.256.mcz [^] |
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
87 total queries executed. 42 unique queries executed. |