Hi Ralph,
I think the important flaw is raku's incapacity to convert a Num to its
exact Rat/FatRat expression. (Note that every finite Num can be expressed
exactly as a Rat/FatRat.)
Without that option we are currently forced to compare Num and Rat/FatRat
as 2 Nums, and I think the option to compar
For exact match one can use eqv:
say 1/10 eqv 0.1e0; # False
say 1/10*1e0 eqv 0.1e0; # True
Best regards,
Vadim Belman
> On Apr 6, 2021, at 7:25 PM, Ralph Mellor wrote:
>
>> 1/10 == 1e1 # True
>>
>> Aiui this is correct (and to me intuitive) behaviour described here:
>
> Except A) that's
On Wed, Apr 7, 2021 at 11:31 PM Vadim Belman wrote:
>
> For exact match one can use eqv:
>
> say 1/10 eqv 0.1e0; # False
> say 1/10*1e0 eqv 0.1e0; # True
>
I don't think this is quite what I'm after.
I would want the following to be True, but it's False:
C:\> raku -e "say 3602879701896397/360287
Would =~= be what you're looking for?
Personally I like Rationals and am looking forward to being able to signify
that they should automatically become FatRats.
But if you're wedded to floating point then :
say 3602879701896397/36028797018963968 =~= 0.1 => True
say 3602879701896397/360287970189
On Wed, Apr 7, 2021 at 3:29 PM Simon Proctor wrote:
>
> Would =~= be what you're looking for?
To quote Wikipedia, "A floating-point number is a rational number".
Rob wants to compare a float with its exact equivalent rational and
get True if they're exactly the same and False otherwise.
--
raip
On Wed, Apr 7, 2021 at 2:12 PM sisyphus wrote:
>
> I think the important flaw is raku's incapacity to convert a Num
> to its exact Rat/FatRat expression.
My 2c is that I agree that that needs to be addressed.
I currently see that as something to first address via sprintf.
Do you agree? I get th