Discussion:
[ast-developers] SFIO sfgetd() support for C99 printf("%a") format?
Lionel Cons
2013-07-13 08:48:55 UTC
Permalink
Does SFIO's sfgetd() have support for C99 printf("%a") format?

Lionel
Glenn Fowler
2013-07-16 14:53:57 UTC
Permalink
Post by Lionel Cons
Does SFIO's sfgetd() have support for C99 printf("%a") format?
both
sfputu()/sfgetu() for integers
and
sfputd()/sfgetd() for floating point
use sfio-specific encodings

sfscanf() handles %a format via ast { strtof strtod strtold strntof strntod strntold }
all implemented by the libast private header src/lib/libast/sfio/sfstrtof.h
Lionel Cons
2013-07-16 14:58:34 UTC
Permalink
Post by Glenn Fowler
Post by Lionel Cons
Does SFIO's sfgetd() have support for C99 printf("%a") format?
both
sfputu()/sfgetu() for integers
and
sfputd()/sfgetd() for floating point
use sfio-specific encodings
Unfortunately that encoding predates IEEE754, i.e. there is no
nan/-nan, working infinite, subnormal numbers or negative zero. That
allows only for very very limited use.
Post by Glenn Fowler
sfscanf() handles %a format via ast { strtof strtod strtold strntof strntod strntold }
all implemented by the libast private header src/lib/libast/sfio/sfstrtof.h
sfscanf() will do. Thanks

Lionel
Glenn Fowler
2013-07-16 16:57:26 UTC
Permalink
Post by Lionel Cons
Post by Glenn Fowler
Post by Lionel Cons
Does SFIO's sfgetd() have support for C99 printf("%a") format?
both
sfputu()/sfgetu() for integers
and
sfputd()/sfgetd() for floating point
use sfio-specific encodings
Unfortunately that encoding predates IEEE754, i.e. there is no
nan/-nan, working infinite, subnormal numbers or negative zero. That
allows only for very very limited use.
good point

the floating point sign is encoded as a byte
0: positive
1: negative
we could retain these for backwards compatibility and use a leading 2
to mark IEEE754 binary interchange format, at the start just for
numbers not encodable by the old sfio format

do you have a www ref for the exact description of the binary interchange format?
Loading...