Logo

Programming-Idioms

History of Idiom 76 > diff from v55 to v56

Edit summary for version 56 by tkoenig:
New Fortran implementation by user [tkoenig]

Version 55

2019-09-26, 21:16:36

Version 56

2019-09-28, 09:48:04

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Extra Keywords
int radix
Extra Keywords
int radix
Code
write (unit=s,fmt='(B0)') 13 ! just the string length
write (unit=s,fmt='(B32)') 13 ! Fills it up with zeros