Disabling Fractions ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Disabling Fractions ?

solar_sea
Hi,
What is the best way to disable fractions or automatically convert
them into say floats ?

Stanislav Paskalev

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Disabling Fractions ?

Lukas Renggli
That's difficult to do, because the system uses them.

Of course you could use machinery like Reflectivity or Helvetia to
make sure they never appear in your context.

Lukas

On 31 July 2010 08:33, Stanislav Paskalev <[hidden email]> wrote:

> Hi,
> What is the best way to disable fractions or automatically convert
> them into say floats ?
>
> Stanislav Paskalev
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Disabling Fractions ?

Stéphane Ducasse
In reply to this post by solar_sea
asFloat?


Stef

On Jul 31, 2010, at 8:33 AM, Stanislav Paskalev wrote:

> Hi,
> What is the best way to disable fractions or automatically convert
> them into say floats ?
>
> Stanislav Paskalev
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Disabling Fractions ?

solar_sea
That's the way I'm doing it now, but it's redundant to put asFloat at
the end of each division. There *should* be a more elegant way, at
least I hope so :)

Stanislav Paskalev



On Sat, Jul 31, 2010 at 10:32 PM, Stéphane Ducasse
<[hidden email]> wrote:

> asFloat?
>
>
> Stef
>
> On Jul 31, 2010, at 8:33 AM, Stanislav Paskalev wrote:
>
>> Hi,
>> What is the best way to disable fractions or automatically convert
>> them into say floats ?
>>
>> Stanislav Paskalev
>>
>> _______________________________________________
>> Pharo-users mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Disabling Fractions ?

Stéphane Ducasse

> That's the way I'm doing it now, but it's redundant to put asFloat at
> the end of each division. There *should* be a more elegant way, at
> least I hope so :)

why?
I do not like to manipulate float when I can have exact math operations.
So I put asFloat exactly when I know I want to leave the math world to end up in the computer science world.

Why do you need float and not fraction?
You crunch matrix resolution with large numbers?

Stef


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Disabling Fractions ?

solar_sea
Purely for display. I'm doing a very basic accounting app that does
not need full accuracy, but saying that the client should pay (X/Y)
amount of cash .. that will be a problem :)

In the end, I might as well keep fractions for the model itself, and
just add asFloat on the view wherever required.

On Sat, Jul 31, 2010 at 10:41 PM, Stéphane Ducasse
<[hidden email]> wrote:

>
>> That's the way I'm doing it now, but it's redundant to put asFloat at
>> the end of each division. There *should* be a more elegant way, at
>> least I hope so :)
>
> why?
> I do not like to manipulate float when I can have exact math operations.
> So I put asFloat exactly when I know I want to leave the math world to end up in the computer science world.
>
> Why do you need float and not fraction?
> You crunch matrix resolution with large numbers?
>
> Stef
>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Disabling Fractions ?

Hernan Wilkinson-3
you should do that... one thing is how your model works and another is how it shows the results to a human (display, printer, etc)... so if you have a number renderer or something like that, you do asFloat there... but that is not enough, you will have to decide how many decimals you want to show, etc. so it is better to use #printShowingDecimalPlaces: and problem solved :-)

On Sat, Jul 31, 2010 at 4:54 PM, Stanislav Paskalev <[hidden email]> wrote:
Purely for display. I'm doing a very basic accounting app that does
not need full accuracy, but saying that the client should pay (X/Y)
amount of cash .. that will be a problem :)

In the end, I might as well keep fractions for the model itself, and
just add asFloat on the view wherever required.

On Sat, Jul 31, 2010 at 10:41 PM, Stéphane Ducasse
<[hidden email]> wrote:
>
>> That's the way I'm doing it now, but it's redundant to put asFloat at
>> the end of each division. There *should* be a more elegant way, at
>> least I hope so :)
>
> why?
> I do not like to manipulate float when I can have exact math operations.
> So I put asFloat exactly when I know I want to leave the math world to end up in the computer science world.
>
> Why do you need float and not fraction?
> You crunch matrix resolution with large numbers?
>
> Stef
>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users



--
Hernán Wilkinson
Agile Software Development, Teaching & Coaching
Mobile: +54 - 11 - 4470 - 7207
email: [hidden email]
site: http://www.10Pines.com


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Disabling Fractions ?

hernanmd
In reply to this post by solar_sea
http://www.squeaksource.com/FixedDecimal.html ?

2010/7/31 Stanislav Paskalev <[hidden email]>:

> Hi,
> What is the best way to disable fractions or automatically convert
> them into say floats ?
>
> Stanislav Paskalev
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users