base2(3f) - [M_strings:BASE] convert whole number to string in base 2 (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
Author
License
function base2(int)
integer,intent(in) :: int character(len=:),allocatable :: base2
Convert a whole number to a string in base 2.
This is often done with the B edit descriptor and an internal WRITE() statement, but is done without calling the I/O routines, and as a function.
int input string representing numeric whole value
base2 string representing input value in base 2
Sample program:
program demo_base2 use M_strings, only : base2 implicit none write(*,(a)) base2(huge(0)) write(*,(a)) base2(0) write(*,(a)) base2(64) write(*,(a)) base2(-64) write(*,(a)) base2(-huge(0)-1) end program demo_base2Results:
> 1111111111111111111111111111111 > 0 > 1000000 > 11111111111111111111111111000000 > 10000000000000000000000000000000
John S. Urban
Public Domain
Nemo Release 3.1 | base2 (3m_strings) | January 10, 2025 |