This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
QhpAptyj9hj0RQwM Hey, is there any way to set the number of significant figures/decimal places I want Raku to use? 17:46
QhpAptyj9hj0RQwM The value I'm getting for 2.8284271247462 - 2.8284271247461903 is 0 17:47
Nemokosch m: say(2.8284271247462 - 2.8284271247461903) 17:48
Raku eval 0.0000000000000097
Nemokosch what is your code exactly, good sir? 17:49
QhpAptyj9hj0RQwM So I'm doing exercise 6.1 in Think Raku, and the value is 0 when it's inside the function
It's also 0 when I do: 17:50
my $x = my-sqrt(8); my $y = sqrt(8); say $x; say $y; say $x - $y;
Nemokosch m: sqrt(8).WHAT.say 17:51
Raku eval (Num)
Nemokosch perhaps that's why. a Num is just a good old floating-point value with the usual implications
QhpAptyj9hj0RQwM Ah, okay. I thought all numbers in Raku used the numerator/denominator thing 17:52
Thanks
Nemokosch if you think about it, sqrt(8) is irrational so it wouldn't work any better. Another reason for floating-point numbers to still exist is performance: they are way faster than two integers "kept in sync" 17:54
teatwo floats kinda are two integers kept in sync. but it's h/w accelerated. :) 17:57