Wednesday, February 06, 2008

New syntax for ratios

Since the very start Factor has supported exact arithmetic on rationals, however the results weren't very readable:
123 321 * 987 / .
13161/329

Now there's a new syntax which factors out the whole part of the fraction:
123 321 * 987 / .
40+1/329

40 and one 329th is a lot easier to think about than 13161ths of 329. Of course this syntax is symmetric so the reader supports it as well.

2 comments:

Adam said...

Do you think this might be confusing? perhaps a /f word for factored results?

Anonymous said...

What do you do with negative ratios?
-1+2/3 looks confusing. -1+-2/3 then?