1. floats
I don't know if the last post made it so here's my question again
I was wondering if there was an easy way to seperate the exponent from a
fractal of a float32
eg: atom float32 float32=12345.54321
I need to make two words [12345][54321] respectively
2. Re: floats
Hayden McKay wrote:
>
> I don't know if the last post made it so here's my question again
>
> I was wondering if there was an easy way to seperate the exponent from a
> fractal of a float32
>
> eg: atom float32 float32=12345.54321
>
> I need to make two words [12345][54321] respectively
>
The absolute easiest is probably to run the number through sprintf.
Something like this (untested):
atom float32 float32 = 12345.54321
sequence float_text, words
float_text = sprintf( "%0.5f", float32 )
words = { float_text[1..$-6], float_text[$-4..$] }
Matt Lewis
3. Re: floats
Thanks Matt this was the type of easy/quick solution i was looking for
Matt Lewis wrote:
>
> Hayden McKay wrote:
> >
> > I don't know if the last post made it so here's my question again
> >
> > I was wondering if there was an easy way to seperate the exponent from a
> > fractal of a float32
> >
> > eg: atom float32 float32=12345.54321
> >
> > I need to make two words [12345][54321] respectively
> >
>
> The absolute easiest is probably to run the number through sprintf.
> Something like this (untested):
> }}}
<eucode>
> atom float32 float32 = 12345.54321
> sequence float_text, words
>
> float_text = sprintf( "%0.5f", float32 )
> words = { float_text[1..$-6], float_text[$-4..$] }
> </eucode>
{{{
>
> Matt Lewis
>
4. Re: floats
> I don't know if the last post made it so here's my question again
>
> I was wondering if there was an easy way to seperate the exponent from a
> fractal of a float32
>
> eg: atom float32 float32=12345.54321
>
> I need to make two words [12345][54321] respectively
This keeps the numbers as numbers, not text.
atom number, whole, decimal
number = 12345.54321
whole = floor( number )
decimal = number - whole
~Greg
5. Re: floats
On 13 Apr 2005, at 11:51, Greg Haberek wrote:
>
> > I don't know if the last post made it so here's my question again
> >=20
> > I was wondering if there was an easy way to seperate the exponent from =
a
> > fractal of a float32
> >=20
> > eg: atom float32 float32
=12
345.54321
> >=20
> > I need to make two words [12345][54321] respectively
>
> This keeps the numbers as numbers, not text.
>
> }}}
<eucode>
> atom number, whole, decimal
>=20
> number =012345.54321
> whole =0F
loor( number )
> decimal=20
>=20
> </eucode>
{{{
What?
Kat
6. Re: floats
> What?
Sorry, apparently Topica has issues with equal signs followed by
numbers, after that it prints all the "equal-number" symbols all over
the place. Let's try this instead:
global function split_number( atom float_number )
atom whole_number, decimal
whole_number = floor( float_number )
decimal = (float_number - whole_number)
return {whole_number, decimal}
end function
~Greg
7. Re: floats
I dont know about Kat, but this is the part I was confused about
...
"seperate the exponent from a
fractal of a float32"
...
but obviously he means to seperate the whole number from the
fractional part, not "fractal"
8. Re: floats
On 13 Apr 2005, at 21:55, Greg Haberek wrote:
>
> > What?
>
> Sorry, apparently Topica has issues with equal signs followed by
> numbers, after that it prints all the "equal-number" symbols all over
> the place. Let's try this instead:
>
> }}}
<eucode>
> global function split_number( atom float_number )
>=20
> atom whole_number, decimal
>=20
> whole_number =0F
loor( float_number )
> decimal=20
>=20
> return {whole_number, decimal}
> end function
> </eucode>
{{{
It did the same again, Greg. Can you try an attachment, or put it on a web=
host so we can http to it?
Kat
9. Re: floats
Greg Haberek wrote:
>
> > What?
>
> Sorry, apparently Topica has issues with equal signs followed by
> numbers, after that it prints all the "equal-number" symbols all over
> the place.
Both your posts look fine in Firefox from EUforum.
-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/
10. Re: floats
> Both your posts look fine in Firefox from EUforum.
I'm gonna have to agree with Kat. They look horrible in GMail.
~Greg
11. Re: floats
cklester wrote:
>
> Greg Haberek wrote:
> >
> > > What?
> >
> > Sorry, apparently Topica has issues with equal signs followed by
> > numbers, after that it prints all the "equal-number" symbols all over
> > the place.
>
> Both your posts look fine in Firefox from EUforum.
>
> -=ck
> "Programming in a state of EUPHORIA."
> <a
> href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
>
I'm using Mozilla 1.7 and the EUForum, the original posts showed correctly for
me as well.
Later.
Ferlin Scarborough
Learn To Program Games in Free Courses
Now contains an Introduction To Euphoria Programming Course At
http://www.gameuniv.net
My Euphoria Home Page
http://mywebpage.netscape.com/shadetreesoft
My Free Games Page
http://freewebtown.com/ferlin
12. Re: floats
Ferlin Scarborough wrote:
>
> cklester wrote:
> >
> > Greg Haberek wrote:
> > >
> > > > What?
> > >
> > > Sorry, apparently Topica has issues with equal signs followed by
> > > numbers, after that it prints all the "equal-number" symbols all over
> > > the place.
> >
> > Both your posts look fine in Firefox from EUforum.
> >
> > -=ck
> > "Programming in a state of EUPHORIA."
> > <a
> > href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
> >
> I'm using Mozilla 1.7 and the EUForum, the original posts showed correctly for
> me as
> well.
>
> Later.
>
> Ferlin Scarborough
Believe it or not, it even looks fine on EUforum with good ol' IE...
13. Re: floats
Greg Haberek wrote:
>
> > What?
>
> Sorry, apparently Topica has issues with equal signs followed by
> numbers, after that it prints all the "equal-number" symbols all over
> the place. Let's try this instead:
>
> }}}
<eucode>
> global function split_number( atom float_number )
>
> atom whole_number, decimal
>
> whole_number = floor( float_number )
> decimal = (float_number - whole_number)
>
> return {whole_number, decimal}
> end function
> </eucode>
{{{
>
> ~Greg
Greg, just try to feed your stillborn baby a negative number. jiri
14. Re: floats
jiri babor wrote:
>
>
> posted by: jiri babor <jbabor at paradise.net.nz>
>
> Greg Haberek wrote:
>
>>}}}
<eucode>
>>global function split_number( atom float_number )
>>
>> atom whole_number, decimal
>>
>> whole_number = floor( float_number )
>> decimal = (float_number - whole_number)
>>
>> return {whole_number, decimal}
>>end function
>></eucode>
{{{
>>
>>~Greg
>
> Greg, just try to feed your stillborn baby a negative number. jiri
It's no worse than your poor choice of metaphor, Mr. B.
--
[ Carl R White == aka () = The Domain of Cyrek = ]
[ Cyrek the Illogical /\ www.cyreksoft.yorks.com ]
15. Re: floats
On 13 Apr 2005, at 22:49, Ferlin Scarborough wrote:
>
>
> posted by: Ferlin Scarborough <ferlin1 at bellsouth.net>
>
> cklester wrote:
> >
> > Greg Haberek wrote:
> > >
> > > > What?
> > >
> > > Sorry, apparently Topica has issues with equal signs followed by
> > > numbers, after that it prints all the "equal-number" symbols all over
> > > the place.
> >
> > Both your posts look fine in Firefox from EUforum.
> >
> > -=ck
> > "Programming in a state of EUPHORIA."
> > <a
> >
> > href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
> >
> I'm using Mozilla 1.7 and the EUForum, the original posts showed correctly for
> me as well.
I am using email, and Topica is mangling the posts.
Kat
16. Re: floats
Kat wrote:
> I am using email, and Topica is mangling the posts.
Somebody needs to beat Topica with a large stick.
-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/
17. Re: floats
On 14 Apr 2005, at 8:57, cklester wrote:
>
>
> posted by: cklester <cklester at yahoo.com>
>
> Kat wrote:
>
> > I am using email, and Topica is mangling the posts.
>
> Somebody needs to beat Topica with a large stick.
Or RDS, considering some reasonably priced web hosts allow 10gigabytes
per month of bandwidth, and php will serve out the list on the http host
easily, and we don't use that much bandwidth. 10gig/mo is 333meg/day, or
over 150 emails for 1000 people (at 2K bytes/email) per day.
Kat
18. Re: floats
> Greg, just try to feed your stillborn baby a negative number. jiri
This is a band-aid on a broken leg, but I think it fixes the problem.
It also handles zero, which has no decimal. :)
global function split_number( atom float_number )
atom whole_number, decimal
if float_number > 0 then
whole_number = floor( float_number )
decimal = (float_number - whole_number)
elsif float_number < 0 then
float_number = -float_number
whole_number = floor( float_number )
decimal = (float_number - whole_number)
whole_number = -whole_number
else
return {0,0}
end if
return {whole_number, decimal}
end function
19. Re: floats
- Posted by Robert Craig <rds at RapidEuphoria.com>
Apr 14, 2005
-
Last edited Apr 15, 2005
It appears that Topica is screwing up Greg Haberek's messages
that contain '=' signs. The messages look fine on Topica's
Web site (as well as on EUforum), so Topica obviously received them
correctly.
Greg, perhaps there is some e-mail setting in gmail that
you can change, because I don't think other gmail users
are having a problem.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com
20. Re: floats
- Posted by jiri babor <jbabor at paradise.net.nz>
Apr 14, 2005
-
Last edited Apr 15, 2005
Carl R. White wrote:
> > Greg, just try to feed your stillborn baby a negative number. jiri
>
> It's no worse than your poor choice of metaphor, Mr. B.
Please, feel free to ignore my metaphors if compelled by cultural/religious
prejudices or just suffering from an overdose of political correctness. jiri
21. Re: floats
Thanks to the guys who replied to my float post
I needed to pass a [(sign)(15-bit diget).(15-diget)(lsb ignored)]
value to an MMX vector routine I was learning from the web.
22. Re: floats
Robert Craig wrote:
>
> It appears that Topica is screwing up Greg Haberek's messages
> that contain '=' signs. The messages look fine on Topica's
> Web site (as well as on EUforum), so Topica obviously received them
> correctly.
>
> Greg, perhaps there is some e-mail setting in gmail that
> you can change, because I don't think other gmail users
> are having a problem.
>
> Regards,
> Rob Craig
> Rapid Deployment Software
> <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
>
For me, one of the messages look like this when viewed through gmail:
<quote>
> I don't know if the last post made it so here's my question again
>
> I was wondering if there was an easy way to seperate the exponent from a
> fractal of a float32
>
> eg: atom float32 float32345.54321
>
> I need to make two words [12345][54321] respectively
This keeps the numbers as numbers, not text.
atom number, whole, decimal
number 12345.54321
whole floor( number )
decimal number - whole
</quote>
Obviously it's not only greg who has this problem. Usually, I don't read or
reply via e-mail, but use the euforum instead, so that's the reason I haven't
discovered it.
Regards, Alexander Toresson