Is 0.0 float or integer
1
Name:
Anonymous
2009-03-21 8:13
12
Name:
Anonymous
2009-03-21 18:55
P#
GNU Prolog
lol toy prologs
13
Name:
Anonymous
2009-03-21 18:58
So
>>12- san, what is an example of a "real" prolog?
14
Name:
Anonymous
2009-03-21 19:01
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
print(type(0.0))
number
15
Name:
Anonymous
2009-03-21 19:05
>>13
Microsoft Visual Studio 2008 Prolog.
16
Name:
Anonymous
2009-03-21 19:11
17
Name:
Anonymous
2010-05-30 6:21
18
Name:
Anonymous
2010-05-30 6:24
>>> type(0.0)
<type 'float'>
>>>
19
Name:
Anonymous
2010-05-30 7:09
20
Name:
Anonymous
2010-05-30 7:22
21
Name:
Anonymous
2010-05-30 11:26
in c++ it's double. 0.0f is float.
22
Name:
Anonymous
2010-05-30 11:57
23
Name:
Anonymous
2010-05-30 15:16
alert(typeof 0.0); // number
24
Name:
Anonymous
2010-05-30 15:18
* (type-of 0.0)
SINGLE-FLOAT
25
Name:
Anonymous
2010-05-30 15:42
ruby -e 'puts (0.0).class'
26
Name:
Anonymous
2010-05-30 15:43
oops forgot output
ruby -e 'puts (0.0).class'
Float
27
Name:
Anonymous
2010-05-30 15:46
> (number? 0.0)
#t
(integer? 0.0)
#t
(exact? 0.0)
#f
All hail the might of abstraction safe languages!
28
Name:
Anonymous
2010-05-31 1:40
% php -r 'echo gettype(0.0), "\n";'
double
%
29
Name:
Anonymous
2010-05-31 2:00
Prelude> :t 0.0
0.0 :: (Fractional t) => t
30
Name:
Anonymous
2010-05-31 2:04
>>29
You're too late¹.
------
¹:
>>6
31
Name:
Anonymous
2010-05-31 3:18
null
32
Name:
Anonymous
2010-05-31 6:10
[code
EnterpriseFloatingPointNumberInstance
[/code]
33
Name:
Anonymous
2010-05-31 6:11
EnterpriseFloatingPointNumberInstance
34
Name:
Anonymous
2010-05-31 6:33
I want you to consider the following paradox:
Prelude> 1.0 == 0.99999999999999999
True
35
Name:
Anonymous
2010-05-31 7:00
I want you to consider the following paradox:
Prelude> 10 == 0xA
True
36
Name:
Anonymous
2010-05-31 8:29
>>35
THE UNIVERSE IS IN DANGER: PART ONE
37
Name:
Anonymous
2010-05-31 10:24
>>> 010.5 - 010
2.5
38
Name:
Anonymous
2010-05-31 10:29
>>37
>>> 010.5 - (010 + .5)
2.0
now that's some quality language design right there.
39
Name:
Anonymous
2010-05-31 10:37
PY3000 fixes some of it:
>>> 010.5 - 010
File "<stdin>", line 1
010.5 - 010
^
SyntaxError: invalid token
>>> 010.5 - 0o10
2.5
40
Name:
Anonymous
2010-05-31 10:38
>>38
You're saying octal shouldn't be recognised?
41
Name:
Anonymous
2010-05-31 11:13
>>38
The answer is obviously
.125.
42
Name:
Anonymous
2010-05-31 11:25
>>40
i'm saying either it shouldn't recognize
010.5, or it should interpret both numbers as octal.
Forced I
nconsistency Of Code.
43
Name:
Anonymous
2010-05-31 11:57
>>42
Well, yeah, it is FIOC, but still. Numbers with a decimal point are going to be, uh, decimal, right?
44
Name:
Anonymous
2010-05-31 12:01
>>43
Not really, you can have a “decimal point” in any base.
45
Name:
Anonymous
2010-05-31 12:16
>>44
Why is it that
0xDEAD.BEEF is illegal?
46
Name:
Anonymous
2010-05-31 13:28
47
Name:
Anonymous
2010-05-31 15:18
>>37
$ perl -le'print(010.5 - 010)'
77
There's more than one way™
48
Name:
Anonymous
2010-05-31 15:45
>>44
"decimal point"
You're looking for "radix point."
49
Name:
Anonymous
2010-05-31 16:35
>>48
s/
>>44 /
>>43 / surely
I uniquoted “decimal point” for a reason. Perhaps if I'd used
sic , you'd have understood.
50
Name:
Anonymous
2010-05-31 16:46
51
Name:
Anonymous
2010-05-31 16:56
>>47
I am thoroughly confused. Care to explain what happened here?
52
Name:
Anonymous
2010-05-31 16:57
53
Name:
Anonymous
2010-05-31 16:58
>>52
But why did it do that!?
54
Name:
Anonymous
2010-05-31 17:00
>>53
Because
Leisure Suit Larry Wall is a religious person and therefore appreciates some mystery in his language.
55
Name:
Anonymous
2010-05-31 17:01
>>50,51
Well, as
>>42 suggested, it doesn't recognize
010.5. But being Perl, there are no syntax errors, only fallback interpretations. So instead it gets read as
010 . 5 - 010, which means
8 5 concat 8 -. 85 - 8 = 77.
56
Name:
Anonymous
2010-05-31 17:53
>>55
That is hideously disgusting. I'm glad I have no experience with that awful language.
57
Name:
Anonymous
2010-05-31 18:01
58
Name:
Anonymous
2010-06-01 1:17
>>56
Because you often try to use a radix point with octal literals?
The cute thing about this example is that it will never happen by accident.
59
Name:
Anonymous
2010-06-01 5:08
>>55
>it gets read as 010 . 5 - 010, which means 8 5 concat 8 -. 85 - 8 = 77.
GENISU
60
Name:
2010-10-26 14:17