Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Is 0.0 float or integer

Name: Anonymous 2009-03-21 8:13

Name: Anonymous 2009-03-21 8:14

float

Name: Anonymous 2009-03-21 8:24

Two widely-staring eyes.

Name: Anonymous 2009-03-21 8:44

flint

Name: Anonymous 2009-03-21 8:48

IEEE double-precision integer

Name: Anonymous 2009-03-21 9:20

0 :: (Fractional t) => t

Name: Anonymous 2009-03-21 11:55

oat

Name: Anonymous 2009-03-21 11:57

doubtful this would even compile unless a 0 object has a 0 method.

Name: Anonymous 2009-03-21 16:47

fixnum

Name: Anonymous 2009-03-21 17:25

irb(main):001:0> 0.0.class
=> Float

Name: Anonymous 2009-03-21 17:38

Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 5.7.8)
Copyright (c) 1990-2009 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- float(0.0).
true.

?- integer(0.0).
false.


P# 1.1.3
Small Prolog Interpreter
| ?- float(0.0).

yes
| ?- integer(0.0).

no


GNU Prolog 1.3.0
By Daniel Diaz
Copyright (C) 1999-2007 Daniel Diaz
| ?- float(0.0).

yes
| ?- integer(0.0).

no

Name: Anonymous 2009-03-21 18:55

P#
GNU Prolog
lol toy prologs

Name: Anonymous 2009-03-21 18:58

So >>12-san, what is an example of a "real" prolog?

Name: Anonymous 2009-03-21 19:01

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
print(type(0.0))
number

Name: Anonymous 2009-03-21 19:05

>>13
Microsoft Visual Studio 2008 Prolog.

Name: Anonymous 2009-03-21 19:11

>>13
SWI-Prolog

Name: Anonymous 2010-05-30 6:21

>>13
ANUS-Prolog

Name: Anonymous 2010-05-30 6:24


>>> type(0.0)
<type 'float'>
>>>

Name: Anonymous 2010-05-30 7:09

>>18
Ah, the C++ repl.

Name: Anonymous 2010-05-30 7:22

>>19
it's python

Name: Anonymous 2010-05-30 11:26

in c++ it's double. 0.0f is float.

Name: Anonymous 2010-05-30 11:57

>>21
Same for Java.

Name: Anonymous 2010-05-30 15:16

alert(typeof 0.0); // number

Name: Anonymous 2010-05-30 15:18


* (type-of 0.0)
SINGLE-FLOAT

Name: Anonymous 2010-05-30 15:42


 ruby -e 'puts (0.0).class'

Name: Anonymous 2010-05-30 15:43

oops forgot output

ruby -e 'puts (0.0).class'
Float

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!

Name: Anonymous 2010-05-31 1:40


% php -r 'echo gettype(0.0), "\n";'
double
%

Name: Anonymous 2010-05-31 2:00

Prelude> :t 0.0
0.0 :: (Fractional t) => t

Name: Anonymous 2010-05-31 2:04

>>29
You're too late¹.

------
¹: >>6

Name: Anonymous 2010-05-31 3:18

null

Name: Anonymous 2010-05-31 6:10

[code
EnterpriseFloatingPointNumberInstance
[/code]

Name: Anonymous 2010-05-31 6:11


EnterpriseFloatingPointNumberInstance

Name: Anonymous 2010-05-31 6:33

I want you to consider the following paradox:
Prelude> 1.0 == 0.99999999999999999
True

Name: Anonymous 2010-05-31 7:00

I want you to consider the following paradox:
Prelude> 10 == 0xA
True

Name: Anonymous 2010-05-31 8:29

>>35
THE UNIVERSE IS IN DANGER: PART ONE

Name: Anonymous 2010-05-31 10:24

>>> 010.5 - 010
2.5

Name: Anonymous 2010-05-31 10:29

>>37
>>> 010.5 - (010 + .5)
2.0

now that's some quality language design right there.

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

Name: Anonymous 2010-05-31 10:38

>>38
You're saying octal shouldn't be recognised?

Name: Anonymous 2010-05-31 11:13

>>38
The answer is obviously .125.

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 Inconsistency Of Code.

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?

Name: Anonymous 2010-05-31 12:01

>>43
Not really, you can have a “decimal point” in any base.

Name: Anonymous 2010-05-31 12:16

>>44
Why is it that 0xDEAD.BEEF is illegal?

Name: Anonymous 2010-05-31 13:28

>>45
0xDEAD.0xBEEF

Name: Anonymous 2010-05-31 15:18

>>37
$ perl -le'print(010.5 - 010)'
77


There's more than one way™

Name: Anonymous 2010-05-31 15:45

>>44
"decimal point"
You're looking for "radix point."

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.

Name: Anonymous 2010-05-31 16:46

>>47
What in the fuck?!

Name: Anonymous 2010-05-31 16:56

>>47
I am thoroughly confused. Care to explain what happened here?

Name: Anonymous 2010-05-31 16:57

>>51
Perl.

Name: Anonymous 2010-05-31 16:58

>>52
But why did it do that!?

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.

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.

Name: Anonymous 2010-05-31 17:53

>>55
That is hideously disgusting. I'm glad I have no experience with that awful language.

Name: Anonymous 2010-05-31 18:01

>>54
ken sent me

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.

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

Name: ​​​​​​​​​​ 2010-10-26 14:17

Name: Anonymous 2011-02-04 11:50

<

Don't change these.
Name: Email:
Entire Thread Thread List