poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] pkl,std: add `format_f32' and `format_f64' std functions


From: Mohammad-Reza Nabipoor
Subject: Re: [PATCH] pkl,std: add `format_f32' and `format_f64' std functions
Date: Sun, 8 Jan 2023 10:17:06 +0100

Hi Jose.

On Sun, Jan 08, 2023 at 12:21:28AM +0100, Jose E. Marchesi wrote:
> 
> Hi Mohammad.
> 
> > This commit adds two new library functions to create string
> > representation of single/double-precision floating-point numbers
> > from uint<32>/uint<64>.
> 
> Wouldn't it be better to add support for %f, %e and %g to `format' and
> `printf' instead of having these library functions?
> 

Yes, but implementing two new functions was easier :)

Are you OK with the following syntax?

  "%f32d"    // float32 in base 10
  "%f64d"    // float64 in base 10

  // With explicit precision
  "%f32.7d"
  "%f64.15d"

  // And other styles
  "%e32d"
  "%e64d"
  "%g32d"
  "%g64d"

In future we can also support other bases (like "%f32b" or "%f64x").


Regards,
Mohammad-Reza



reply via email to

[Prev in Thread] Current Thread [Next in Thread]