Re: [libertyeiffel] Arithmetic
- From:
- Cyril Adrian
- Date:
- 2011-10-07 @ 11:10
Hi,
2011/10/7 <christophe.haro@free.fr>
> I have some questions :
>
> 1) INTEGER is actually INTEGER_32 and feature bit_count is private. But the
> situation can progress (in the futur) so that INTEGER will be INTEGER_64 for
> instance.
I'd rather implement a not-finite INTEGER, a la python.
Hence, What do you think to export bit_count to ANY ?
>
I guess it does no harm.
> 2) Actually, when I want to know what is the biggest (resp. smallest)
> integer, I define :
> 2.a) Do you know a better solution ?
>
Yes: insert PLATFORM and use Minimum_integer and Maximum_integer
> 2.b) As far as I know, these values are not defined in any class. Why
> not ?
>
But they are: see above :-)
In good old Eiffel 3, PLATFORM was inherited by ANY. Now it is an
independent class that has to be inserted when needed.
Cheers,
*Cyril ADRIAN **(from office)
http://www.cadrian.net/cyril *
Share with me: [image: Twitter] <http://www.twitter.com/cadbart> [image:
LinkedIn] <http://fr.linkedin.com/in/cadrian> [image: Google
Calendar]<https://www.google.com/calendar/embed?src=1t93vvvrdc26ee0f83p0cunj60%40group.calendar.google.com&ctz=Europe/Paris>
[image:
Google Plus] <https://plus.google.com/100388810006463519079>
Contact me: [image: Google Talk] cyril.adrian@gmail.com
[image: Twitter] <http://twitter.com/cadbart> Latest tweet: [Liberty]
http://t.co/HVba0IX Cyril Adrian - useful option.
Follow @cadbart <http://twitter.com/cadbart> Reply
<http://twitter.com/?status=@cadbart%20&in_reply_to_status_id=106427146326654980&in_reply_to=cadbart>
Retweet
<http://twitter.com/?status=RT%20%40cadbart%3A%20%5BLiberty%5D%20http%3A%2F%2Ft.co%2FHVba0IX%20Cyril%20Adrian%20-%20useful%20option.>
20:06 Aug-24<http://twitter.com/cadbart/statuses/106427146326654976>
Get this email app!
<http://www.wisestamp.com/apps/twitter?utm_source=extension&utm_medium=email&utm_term=twitter&utm_campaign=apps>
[image: My QR VCard]
Get a signature like this.
<http://r1.wisestamp.com/r/landing?promo=19&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_19>
CLICK
HERE.<http://r1.wisestamp.com/r/landing?promo=19&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_19>
Re: [libertyeiffel] Arithmetic
- From:
- Paolo Redaelli
- Date:
- 2011-10-07 @ 15:56
Cyril has been faster than me. I would have written the same things.
Il 07/10/2011 13:10, Cyril ADRIAN ha scritto:
> Hi,
>
> 2011/10/7 <christophe.haro@free.fr <mailto:christophe.haro@free.fr>>
>
> I have some questions :
>
> 1) INTEGER is actually INTEGER_32 and feature bit_count is
> private. But the situation can progress (in the futur) so that
> INTEGER will be INTEGER_64 for instance.
>
>
> I'd rather implement a not-finite INTEGER, a la python.
>
I'm wondering how we could implement them with the required efficiency.
I've been thinking about a couple of technique or two, something like:
struct {
bool is_int;
union inner_int {
int my_integer;
void *reference_to_a_bigger_struct
}
}
but:
1 - I'd rather write it in Eiffel, wishing it has unions...
2 - it's fatter than a plain int; I do know a couple tricks about
storing a couple of bits into 4-bytes-aligned pointers which could work,
provided we turn INTEGER into a INTEGER_31_OR_BIGGER...
3 - I still wish we have portable access to the overflow flag in CPU....
More on this later.....
Re: [libertyeiffel] Arithmetic
- From:
-
- Date:
- 2011-10-07 @ 11:20
Thank you Cyril.
C
----- Mail original -----
De: "Cyril ADRIAN" <cyril.adrian@gmail.com>
À: libertyeiffel@librelist.com
Envoyé: Vendredi 7 Octobre 2011 13:10:33
Objet: Re: [libertyeiffel] Arithmetic
Hi,
2011/10/7 < christophe.haro@free.fr >
I have some questions :
1) INTEGER is actually INTEGER_32 and feature bit_count is private. But
the situation can progress (in the futur) so that INTEGER will be
INTEGER_64 for instance.
I'd rather implement a not-finite INTEGER, a la python.
Hence, What do you think to export bit_count to ANY ?
I guess it does no harm.
2) Actually, when I want to know what is the biggest (resp. smallest)
integer, I define :
2.a) Do you know a better solution ?
Yes: insert PLATFORM and use Minimum_integer and Maximum_integer
2.b) As far as I know, these values are not defined in any class. Why not ?
But they are: see above :-)
In good old Eiffel 3, PLATFORM was inherited by ANY. Now it is an
independent class that has to be inserted when needed.
Cheers,
Cyril A DRIAN (from office)
http://www.cadrian.net/cyril
Share with me: TwitterLinkedInGoogle CalendarGoogle Plus
Contact me: Google Talkcyril.adrian@gmail.com
Twitter Latest tweet: [Liberty] http://t.co/HVba0IX Cyril Adrian - useful option.
Follow @cadbart Reply Retweet 20:06 Aug-24 Get this email app!
My QR VCard
Get a signature like this. CLICK HERE.