Hacker News new | ask | show | jobs
by anthk 386 days ago
pi/pi would evaluate to 1 as most proper languages would deal with pi symbolically and not arithmetically.
3 comments

My point was only that even trivial arithmetic is impossible to do with the infinite decimal representations of irrational numbers.
in 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

in raku

  say pi/pi;   #1
Sadly, that's just Num.gist showing 1.0 as "1" though.

say (pi/pi).^name; # Num

lol … 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