Re: [Factor-talk] Ratio vs. Float
If you enter -81/2 instead of -40.5 it should work. 2017-01-20 0:07 GMT+01:00 Alexander Ilin: > Thank you, Jon, now I understand what the problem is. > Unfortunately, in my case I can't use `number=` because the comparison is > done by the unit-test word. > In the following code the first test succeeds, but the second one fails: > > ``` > { 15 } [ 10 20 middle ] unit-test > { -40.5 } [ -50 -31 middle ] unit-test > ``` > > 20.01.2017, 01:30, "Jon Harper" : > > Hi, > you have to use number= to compare numbers with different types. > http://docs.factorcode.org/content/word-number=,math.html > > Jon > > Jon > > On Thu, Jan 19, 2017 at 10:50 PM, Alexander Ilin wrote: > > Hello! > > I'm a bit confused. Why is following not true? > > `81/2 40.5 =` > > ---=--- > Александр > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > , > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > , > > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > ---=--- > Александр > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- mvh/best regards Björn Lindqvist -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Ratio vs. Float
Ah! That's excellent advice, thank you again! 20.01.2017, 02:25, "Jon Harper":A classic workaround when = is not what you want in unit tests is to do the work in the quotation and return a boolean (or anything for which = works) and use { t } as the expected output. Le 20 janv. 2017 00:08, "Alexander Ilin" a écrit :Thank you, Jon, now I understand what the problem is.Unfortunately, in my case I can't use `number=` because the comparison is done by the unit-test word.In the following code the first test succeeds, but the second one fails: ```{ 15 } [ 10 20 middle ] unit-test{ -40.5 } [ -50 -31 middle ] unit-test``` 20.01.2017, 01:30, "Jon Harper" :Hi,you have to use number= to compare numbers with different types.http://docs.factorcode.org/content/word-number=,math.html Jon Jon On Thu, Jan 19, 2017 at 10:50 PM, Alexander Ilin wrote:Hello! I'm a bit confused. Why is following not true? `81/2 40.5 =`---=--- Александр--Check out the vibrant tech community on one of the world's mostengaging tech sites, SlashDot.org! http://sdm.link/slashdot___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk,--Check out the vibrant tech community on one of the world's mostengaging tech sites, SlashDot.org! http://sdm.link/slashdot,___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk ---=---Александр --Check out the vibrant tech community on one of the world's mostengaging tech sites, SlashDot.org! http://sdm.link/slashdot___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk ,--Check out the vibrant tech community on one of the world's mostengaging tech sites, SlashDot.org! http://sdm.link/slashdot,___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk ---=---Александр -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Ratio vs. Float
A classic workaround when = is not what you want in unit tests is to do the work in the quotation and return a boolean (or anything for which = works) and use { t } as the expected output. Le 20 janv. 2017 00:08, "Alexander Ilin"a écrit : > Thank you, Jon, now I understand what the problem is. > Unfortunately, in my case I can't use `number=` because the comparison is > done by the unit-test word. > In the following code the first test succeeds, but the second one fails: > > ``` > { 15 } [ 10 20 middle ] unit-test > { -40.5 } [ -50 -31 middle ] unit-test > ``` > > 20.01.2017, 01:30, "Jon Harper" : > > Hi, > you have to use number= to compare numbers with different types. > http://docs.factorcode.org/content/word-number=,math.html > > Jon > > Jon > > On Thu, Jan 19, 2017 at 10:50 PM, Alexander Ilin wrote: > > Hello! > > I'm a bit confused. Why is following not true? > > `81/2 40.5 =` > > ---=--- > Александр > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > , > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > , > > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > ---=--- > Александр > > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Ratio vs. Float
Thank you, Jon, now I understand what the problem is.Unfortunately, in my case I can't use `number=` because the comparison is done by the unit-test word.In the following code the first test succeeds, but the second one fails: ```{ 15 } [ 10 20 middle ] unit-test{ -40.5 } [ -50 -31 middle ] unit-test``` 20.01.2017, 01:30, "Jon Harper":Hi,you have to use number= to compare numbers with different types.http://docs.factorcode.org/content/word-number=,math.html Jon Jon On Thu, Jan 19, 2017 at 10:50 PM, Alexander Ilin wrote:Hello! I'm a bit confused. Why is following not true? `81/2 40.5 =`---=--- Александр--Check out the vibrant tech community on one of the world's mostengaging tech sites, SlashDot.org! http://sdm.link/slashdot___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk,--Check out the vibrant tech community on one of the world's mostengaging tech sites, SlashDot.org! http://sdm.link/slashdot,___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk ---=---Александр -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Ratio vs. Float
Hi, you have to use number= to compare numbers with different types. http://docs.factorcode.org/content/word-number=,math.html Jon Jon On Thu, Jan 19, 2017 at 10:50 PM, Alexander Ilinwrote: > Hello! > > I'm a bit confused. Why is following not true? > > `81/2 40.5 =` > > ---=--- > Александр > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Ratio vs. Float
Hello! I'm a bit confused. Why is following not true? `81/2 40.5 =` ---=--- Александр -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk