Xah Talk Show 2025-09-16 Ep702 the C Printf Crime and New Syntax for String, Rock-String

xah talk show ep702 1684a
xah talk show ep702 1684a

Video Summary (Generated by AI)

x = 3.256
print( "the price is %f" % x )
# the price is 3.256000

x = 3.256
print( "the price is %.2f" % x )
# the price is 3.26

x = 123.256
print( "the price is %5.2f" % x )
the price is 123.26

x = 123.256
print( "the price is %9.2f" % x )
# the price is    123.26

y = 17
print( "hexadecimal of %d is %x" % ( y, y) )
# hexadecimal of 17 is 11
# show 2 decimal places, with grouping

"{0:n2}" -f 123456789.123456789
# 123,456,789.12

"the decimal number {0:d} in hexadecimal is {0:x}" -f 17
# the decimal number 17 in hexadecimal is 11
(let ((x 17))
 (print (format "decimal number %d in hexadecimal is %x" x x))
)
;; "decimal number 17 in hexadecimal is 11"
package main

import "fmt"

func main() {

	var x = 17

	fmt.Printf("decimal %d in hexadecimal is %x \n", x, x)
	// decimal 17 in hexadecimal is 11
}
x = 17;
StringTemplate["decimal number `` in hexadecimal is ``"][x, IntegerString[x,16] ]
(* decimal number 17 in hexadecimal is 11 *)
BaseForm[{0, 1, 5, 17}, 2]
(* BaseForm[{0, 1, 5, 17}, 2] *)

ToString[ BaseForm[{0, 1, 5, 17}, 2] ]
(* 
{0 , 1 , 101 , 10001 }
  2   2     2       2
*)
xah talk show ep702 Wolfram BaseForm
xah talk show ep702 Wolfram BaseForm

C lang printf problem