Share Your Experience: Take the 2024 Developer Survey

# Tag Info

### Floating Point XOR

x86-64 machine code, 4 bytes 0f 57 c1 c3 In assembly: xorps xmm0, xmm1 ret This is a callable function that takes two floats ...
• 1,419

### Float 754 to Hamming

x86_64 machine language (Linux), 16 bytes ...
• 7,605

### Implement Ash's float division

Haskell, 35 bytes x?y|isNaN\$x/y=tanh x*tanh y|0<1=x/y Try it online! The relevant function is (?), which takes two ...
• 6,266

### Convert an integer to IEEE 754 float

Python, 55 bytes Correct as per original challenge description (always add 2^23 to mantissa) but not per IEEE. ...
• 16.7k

### Vanilla Natural Logarithm Challenge

Excel, 19 16 bytes With many thanks to Dominic van Essen for the 3-byte save: =1E9*(A1^1E-9-1) Previous: =9^9*(A1^(1/9^9)-1) ...
• 1,942

### Convert an integer to IEEE 754 float

x86 32-bit machine code, 5 bytes D9 44 24 04 C3 Try it online! Following the cdecl calling convention, this takes the 32-bit ...
• 10.5k

### Convert an integer to IEEE 754 float

Rust, 14 bytes f32::from_bits Not even reached the 30 byte min limit for posts
• 12.6k

### Implement Ash's float division

JavaScript (ES6), 45 bytes Expects (a)(b), as Numbers. Returns a Number. ...
• 193k

### Float 754 to Hamming

C (gcc), 82 68 bytes 9 bytes thanks to Neil. evil floating point bit level hacking s;f(long n){double d=n;n=*(long*)&d;for(s=0;n;n*=2)s+=n<0;return s;} ...
• 49.8k

### Floating Point XOR

C++ (gcc), 74 32 bytes #define f(x,y)*(int*)x^=*(int*)y Try it online! I haven’t previously golfed in C++ so am grateful to all those who helped halve the size ...
• 21.1k

### Implement Ash's float division

Julia 0.7, 26 bytes imaginary brownie points for using tanh instead of sign (thanks Delfad0r) ...
• 6,505

### Vanilla Natural Logarithm Challenge

Builtins These answers are in alphabetical order based on programming language. If your answer is identical to an existing one, please combine them. 05AB1E, 4 bytes ...

### Vanilla Natural Logarithm Challenge

><> (Fish), 71 bytes Trying to solve this in ><> was the original inspiration for this challenge. Posting this now instead of waiting the usual 24 hours to hopefully inspire more ...
• 12.6k

### Bitwise XOR of floats

JavaScript, 47 bytes f=(x,y,k=8**341)=>k&&k*(x<k^y<k)+f(x%k,y%k,k/2) Try it online! k runs through every ...
• 10.5k

### Vanilla Natural Logarithm Challenge

Hexagony, 161 122 bytes ...
• 4,437

### Float 754 to Hamming

Python 3, 72 71 bytes 1 byte thanks to Lynn. lambda n:n and(bin(1020+len(bin(abs(n))))+bin(abs(n))).count('1')-(n>0) Try it online! Explanation The ...
• 49.8k
Accepted

### Float 754 to Hamming

MATL, 5 bytes 3Z%Bz Try it online! Exact transliteration of my MATLAB answer. Note that input and output are implicit. -2 bytes thanks to Luis Mendo. ...
• 9,496

### Floating Point XOR

ARM Thumb Machine Code, 6 4 Bytes 48 40 70 47 In assembly: EORS R0, R1 ; Exclusive Or of the first two params, store result in the return register BX LR ; Branch to the value stored in the ...
• 4,983

### Implement Ash's float division

R, 98 95 89 88 bytes -6 bytes thanks to Giuseppe function(x,y=abs(scan(t=x)))cat("-"[!!sd(grepl("-",x))],c(z<-y[1]/y[2],!!y)[1+is.na(z)]) ...
• 15.6k

### Cartesian - polar conversion couple

Python, 49 + 48 = 97 bytes -2 thanks to @Seb lambda r,a,n=9e9:((x:=r*(a/n-1j)**n).real,x.imag) Attempt This Online! lambda x,y,n=1e-9:(abs(c:=x+1j*y),(c**n).imag/n) Doesn't use any libraries, no exp, ...
• 16.7k

### Convert an integer to IEEE 754 float

C (GCC) without reliance on undefined behaviour, 41 40 bytes #define f(x)((union{int a;float b;})x).b Attempt This Online! Type-punning through pointers does ...
• 191

### Fast inverse square root

FORTRAN, 124 113 Chars saved 11 Bytes thanks to rafa11111 I know that this question is rather old, but it deserves a FORTRAN answer. It cannot outgolf Perl or Jelly, but it is at least not the worst....
• 81

### Float 754 to Hamming

C (gcc), 47 bytes f(double n){n=__builtin_popcountl(*(long*)&n);} This isn't portable; it was tested with gcc 7.1.1 on x86_64 running Linux, without compiler ...
• 210k

### Output with the same number of digits of pi as the length of the code

Mathematica, 18 bytes using zeta function Sqrt[6Zeta@2]~N~18 Try it online!
• 24.9k

### Display the exponent from a binary floating point number as a decimal value

Python 3, 26 bytes lambda s:int(s[1:9],2)-127 Try it online!
• 20.2k

### Display the exponent from a binary floating point number as a decimal value

C (gcc), 55 $\cdots$ 40 36 bytes Saved 2 6 bytes thanks to ceilingcat!!! Saved 2 a whopping 13 bytes thanks to Arnauld!!! #define f(s)strtol(s+1,s[9]=0,2)-127 ...
• 20.2k

### Display the exponent from a binary floating point number as a decimal value

Haskell, 33 bytes foldl1(\x y->x*2+y-1).take 8.tail Try it online! Input is a list of integers 0 or 1. It's slightly shorter to ...
• 68.7k