Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 22 characters in body
Source Link
Kaddath
  • 2.9k
  • 5
  • 9

PHP, 1617 bytes

$argn<?=$argn/sqrt(2)|0;2**.5|0;

Try it online! (with highest value supported on TIO)Try it online!

Uses @Niphram's truncate method (which in PHP also has the ability to convert the float to an int)

I know it's trendy to say PHP is to be hated, but I kinda came to like its oddities, and it gives me a chance to add an original answer

EDIT: saved 4 bytes using <?= php tag (no need to echo)

EDIT2: basically it's just a port of @Niphram's answer now

PHP, 16 bytes

$argn/sqrt(2)|0;

Try it online! (with highest value supported on TIO)

Uses @Niphram's truncate method (which in PHP also has the ability to convert the float to an int)

I know it's trendy to say PHP is to be hated, but I kinda came to like its oddities, and it gives me a chance to add an original answer

EDIT: saved 4 bytes using <?= php tag (no need to echo)

PHP, 17 bytes

<?=$argn/2**.5|0;

Try it online!

Uses @Niphram's truncate method (which in PHP also has the ability to convert the float to an int)

I know it's trendy to say PHP is to be hated, but I kinda came to like its oddities, and it gives me a chance to add an original answer

EDIT: saved 4 bytes using <?= php tag (no need to echo)

EDIT2: basically it's just a port of @Niphram's answer now

added 37 characters in body
Source Link
Kaddath
  • 2.9k
  • 5
  • 9

PHP, 2016 bytes

echo$argn$argn/sqrt(2)|0;

Try it online! Try it online! (with highest value supported on TIO)

Uses @Niphram's truncate method (which in PHP also has the ability to convert the float to an int)

I know it's trendy to say PHP is to be hated, but I kinda came to like its oddities, and it gives me a chance to add an original answer

EDIT: saved 4 bytes using <?= php tag (no need to echo)

PHP, 20 bytes

echo$argn/sqrt(2)|0;

Try it online! (with highest value supported on TIO)

Uses @Niphram's truncate method (which in PHP also has the ability to convert the float to an int)

I know it's trendy to say PHP is to be hated, but I kinda came to like its oddities, and it gives me a chance to add an original answer

PHP, 16 bytes

$argn/sqrt(2)|0;

Try it online! (with highest value supported on TIO)

Uses @Niphram's truncate method (which in PHP also has the ability to convert the float to an int)

I know it's trendy to say PHP is to be hated, but I kinda came to like its oddities, and it gives me a chance to add an original answer

EDIT: saved 4 bytes using <?= php tag (no need to echo)

Source Link
Kaddath
  • 2.9k
  • 5
  • 9

PHP, 20 bytes

echo$argn/sqrt(2)|0;

Try it online! (with highest value supported on TIO)

Uses @Niphram's truncate method (which in PHP also has the ability to convert the float to an int)

I know it's trendy to say PHP is to be hated, but I kinda came to like its oddities, and it gives me a chance to add an original answer

AltStyle によって変換されたページ (->オリジナル) /