Difference between float, double and real?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on
currently there are those functions is_float, is_double and is_real,
which do exactly the same as far as i can see
what surprises me is that \$a = (float/double/real) 1; all work, while
with settype() only float and double work, and 'real' not.
now im wondering, is there any difference between those?

and if not, will they all keep existing in php6? or will php continue
with only one of them?

Re: Difference between float, double and real?

Wander wrote:

The amount of memory they need.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

"Las religiones, como las luciérnagas, necesitan de oscuridad para brillar"
(Arthur Schopenhauer)

Re: Difference between float, double and real?

On May 22, 5:12 pm, Iv=E1n S=E1nchez Ortega <ivansanchez-...@rroba-
escomposlinux.-.punto.-.org> wrote:

thanks for your quick response, could you tell me which of the 3 takes
the most memory, and which of them needs the least?

Re: Difference between float, double and real?

Wander wrote:

It really depends on your platform and the configuration of your
interpreter/compiler, but the most common scenario is that floats are
single-precision 32-bit IEEE 754 floating numbers; reals are an alias for
doubles; and doubles are double-precision 64-bit IEEE 754 floating numbers.

I suggest you to drop by http://en.wikipedia.org/wiki/IEEE_754-1985 in order
to learn a bit more.

And, of course, you've earned yourself a RTFM for not reading this:
http://php.net/language.types.float

"The size of a float is platform-dependent, although a maximum of ~1.8e308
with a precision of roughly 14 decimal digits is a common value (the 64 bit
IEEE format)."

Cheers,
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Proudly running Debian Linux with 2.6.24-1-amd64 kernel, KDE 3.5.9, and PHP
5.2.6-1 generating this signature.
Uptime: 21:49:42 up 22 days,  1:10,  3 users,  load average: 1.04, 0.87,
0.67

Re: Difference between float, double and real?

They're all the same.  According to the manual, both is_real() and
is_double() are simply aliases for is_float().  Also, according to the
manual, the "type" parameter to settype() takes "float" since PHP
4.2.0 as the "double" variant was deprecated.