Re: Help!!!!!
Oops! I accidentally posted a mid-edited message. Sorry folks. I'll try
again. <
On Fri, 17 Apr 1998, CAMPOS ARRIBAS- LUIS RAUL wrote:
> Hi guys!!!
>
> Can someone tell me what the hell i have to do to transform
> a large number ( 2000000000000 ) in to a string?I use the
> sprintf() function but the string it returns is in the 'e'
> format! ( something like "2.0e7" )
Provided sprintf("%f", 2000000000000) doesn't work either, you'll have to
code a solution.
I have a whole set of routines that do things like this, called basebag.e,
but I haven't got them on this server yet (aargh!).
They're of the form (off the top of my head):
function seq2atom(sequence seq, numbase base)
-- convert the "seq" string of a number in base "base", into a real
-- floating point atom.
end function
function atom2seq(atom number, numbase base)
-- convert "number" into a string representation of itself in base
-- "base" with floating point handling.
end function
function baseconv(sequence seq, numbase from, numbase to_)
return atom2seq(seq2atom(seq, from), to_)
end function
So, baseconv("3.14159265359", 10, 16) returns something like "3.243F6A88"
and baseconv("3.14159265359", 10, 2) returns:
"11.00100100001111110110101010001000001" (!!!)
I'll put basebag.e on my site sometime around the end of this week...
--
Carl R White - "FBIbait: The President will be castrated in his sleep."
E-mail...: cyrek- at -bigfoot.com / Remove the hyphens before
Finger...: crwhite- at -dcsun1.comp.brad.ac.uk \ mailing or fingering...
Url......: http://www.bigfoot.com/~cyrek/
|
Not Categorized, Please Help
|
|