Hi, What is the best way to disable fractions or automatically convert them into say floats ? Stanislav Paskalev
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 <kshorg@gmail.com> wrote:
Hi, What is the best way to disable fractions or automatically convert them into say floats ?
Stanislav Paskalev
_______________________________________________ Pharo-users mailing list Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
-- Lukas Renggli www.lukas-renggli.ch
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 Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
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 <stephane.ducasse@inria.fr> 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 Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________ Pharo-users mailing list Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
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
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 <stephane.ducasse@inria.fr> 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 Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
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 <kshorg@gmail.com>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 <stephane.ducasse@inria.fr> 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 Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________ Pharo-users mailing list Pharo-users@lists.gforge.inria.fr 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: hernan.wilkinson@10Pines.com site: http://www.10Pines.com <http://www.10pines.com/>*
http://www.squeaksource.com/FixedDecimal.html ? 2010/7/31 Stanislav Paskalev <kshorg@gmail.com>:
Hi, What is the best way to disable fractions or automatically convert them into say floats ?
Stanislav Paskalev
_______________________________________________ Pharo-users mailing list Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
participants (5)
-
Hernan Wilkinson -
Hernán Morales Durand -
Lukas Renggli -
Stanislav Paskalev -
Stéphane Ducasse