Re: So...what if I wanted to do something like atof?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jonas,

Not really sure, but you might look at:

"atom_to_float64()"

Syntax: include machine.e
s = atom_to_float64(a1)

Description: Convert a Euphoria atom to a sequence of 8 single-byte values.
These 8 bytes contain the representation of an IEEE floating-point number in
64-bit format.
Comments: All Euphoria atoms have values which can be represented as 64-bit
IEEE floating-point numbers, so you can convert any atom to 64-bit format
without losing any precision.
Integer values will also be converted to 64-bit floating-point format.

Example:
 fn = open("numbers.dat", "wb")
puts(fn, atom_to_float64(157.82)) -- write 8 bytes to a file

Dan Moyer


----- Original Message -----
From: "Jonas" <jktemple at USMO.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, December 11, 2000 7:08 PM
Subject: So...what if I wanted to do something like atof?


> First of all, since this is my first post to this server, let me say
> this... Do you know how many years it took me to get comfortable with
> C/C++? Do you know how many days it took me to get comfortable with
> Euphoria?  'nough said.
>
> Anyway, I have been working on a project using Euphoria and Win32Lib.  I
> have an edit control where I want the user to enter a price.  I want to
> convert and store that sequence as a floating point.  In C++ I would have
> probably used atof() to do that conversion.  What is the functional
> equivalent in Euphoria?
>
> Thanks for the help in advance.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu