3 ms·
pi/pi would evaluate to 1 as most proper languages would deal with pi symbolically and not arithmetically.
by anthk 1y ago
pi/pi would evaluate to 1 as most proper languages would deal with pi symbolically and not arithmetically.
- tsimionescu 1y agoMy point was only that even trivial arithmetic is impossible to do with the infinite decimal representations of irrational numbers.
- librasteve 1y agoin raku say pi/pi; #1
- lizmat 1y agoSadly, that's just Num.gist showing 1.0 as "1" though. say (pi/pi).^name; # Num
- librasteve 1y agolol … my bad I should have realized that pi is a Num since it’s an Irrational and a Num over a Num is a Num
- librasteve 1y agoin python import math result = math.pi / math.pi print(result) #1.0 bit more long winded than raku, but nearly right fwiw I want my pi/pi to be 1 (ie an Int) not 1.0 but then I’m a purist