equal
deleted
inserted
replaced
19 category:'Magnitude-Numbers' |
19 category:'Magnitude-Numbers' |
20 ! |
20 ! |
21 |
21 |
22 !Float primitiveDefinitions! |
22 !Float primitiveDefinitions! |
23 %{ |
23 %{ |
|
24 #include <stdio.h> |
24 #include <errno.h> |
25 #include <errno.h> |
25 |
26 |
26 #ifndef __OPTIMIZE__ |
27 #ifndef __OPTIMIZE__ |
27 # define __OPTIMIZE__ |
28 # define __OPTIMIZE__ |
28 #endif |
29 #endif |
1898 This assumes that the mantissa is normalized to |
1899 This assumes that the mantissa is normalized to |
1899 0.5 .. 1.0 and the float's value is: mantissa * 2^exp" |
1900 0.5 .. 1.0 and the float's value is: mantissa * 2^exp" |
1900 |
1901 |
1901 %{ /* NOCONTEXT */ |
1902 %{ /* NOCONTEXT */ |
1902 |
1903 |
1903 double frexp(); |
|
1904 double frac; |
1904 double frac; |
1905 int exp; |
1905 int exp; |
1906 |
1906 |
1907 __threadErrno = 0; |
|
1908 frac = frexp(__floatVal(self), &exp); |
1907 frac = frexp(__floatVal(self), &exp); |
1909 if (__threadErrno == 0) { |
1908 RETURN (__mkSmallInteger(exp)); |
1910 RETURN (__mkSmallInteger(exp)); |
1909 %}. |
1911 } |
|
1912 %}. |
|
1913 ^ self primitiveFailed |
|
1914 |
1910 |
1915 " |
1911 " |
1916 1.0 exponent |
1912 1.0 exponent |
1917 2.0 exponent |
1913 2.0 exponent |
1918 3.0 exponent |
1914 3.0 exponent |
1933 This assumes that the mantissa is normalized to |
1929 This assumes that the mantissa is normalized to |
1934 0.5 .. 1.0 and the floats value is mantissa * 2^exp" |
1930 0.5 .. 1.0 and the floats value is mantissa * 2^exp" |
1935 |
1931 |
1936 %{ /* NOCONTEXT */ |
1932 %{ /* NOCONTEXT */ |
1937 |
1933 |
1938 double frexp(); |
|
1939 double frac; |
1934 double frac; |
1940 int exp; |
1935 int exp; |
1941 |
1936 |
1942 __threadErrno = 0; |
|
1943 frac = frexp(__floatVal(self), &exp); |
1937 frac = frexp(__floatVal(self), &exp); |
1944 if (__threadErrno == 0) { |
1938 RETURN (__MKFLOAT(frac)); |
1945 RETURN (__MKFLOAT(frac)); |
1939 %}. |
1946 } |
|
1947 %}. |
|
1948 ^ self primitiveFailed |
|
1949 |
1940 |
1950 " |
1941 " |
1951 1.0 exponent |
1942 1.0 exponent |
1952 1.0 mantissa |
1943 1.0 mantissa |
1953 |
1944 |
2854 ! ! |
2845 ! ! |
2855 |
2846 |
2856 !Float class methodsFor:'documentation'! |
2847 !Float class methodsFor:'documentation'! |
2857 |
2848 |
2858 version |
2849 version |
2859 ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.186 2013-01-29 12:27:45 cg Exp $' |
2850 ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.187 2013-02-05 15:29:32 stefan Exp $' |
2860 ! |
2851 ! |
2861 |
2852 |
2862 version_CVS |
2853 version_CVS |
2863 ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.186 2013-01-29 12:27:45 cg Exp $' |
2854 ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.187 2013-02-05 15:29:32 stefan Exp $' |
2864 ! ! |
2855 ! ! |
2865 |
2856 |
2866 |
2857 |
2867 Float initialize! |
2858 Float initialize! |