On 05/18, Mark Rivers wrote:
> This might actually be a good case to use a double. You get exact
> representation for 52 bits, i.e. 20 bits more than int32, or 1M times
> higher rate.
Interesting. So that's for the IEEE 754 double-precision binary
floating-point format (64-bit). Assuming epicsFloat64 is that, then
the maximum integer, such that it and all smaller integers can be
represented exactly, is 2^53 = 9,007,199,254,740,992 according to [1]
and [2]. And I believe the minimum is just the negation of that since
the sign has its own bit.
I had to go read about the 64-bit format [3], and apparently there's
one more bit available for the signficand, sometimes referred to as the
hidden bit, which is where the 53 comes from (i.e., 52 + 1). The 64-bit
format stores the number in binary normalized form, so the first bit
will always be 1, so it is omitted, thus gaining one extra bit for the
significand.
Anyway, I guess I'll use asynParamFloat64, then, and return an error if
the bit rate is less than -2^53 or greater than 2^53.
Thanks!
Lewis
[1] https://stackoverflow.com/a/1848762
[2] https://stackoverflow.com/a/1848953
[3] https://en.wikipedia.org/wiki/IEEE_754-1985
- Replies:
- Re: Store 64-bit integer in asyn parameter library? Luca Cavalli
- References:
- Store 64-bit integer in asyn parameter library? J. Lewis Muir
- Re: Store 64-bit integer in asyn parameter library? J. Lewis Muir
- Re: Store 64-bit integer in asyn parameter library? Mark Rivers
- Re: Store 64-bit integer in asyn parameter library? J. Lewis Muir
- Re: Store 64-bit integer in asyn parameter library? Mark Rivers
- Re: Store 64-bit integer in asyn parameter library? J. Lewis Muir
- Re: Store 64-bit integer in asyn parameter library? Mark Rivers
- Navigate by Date:
- Prev:
Job Opening at Fermilab, Accelerator Instrumentation Department Dennis Nicklaus
- Next:
Re: Store 64-bit integer in asyn parameter library? Luca Cavalli
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
<2018>
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Store 64-bit integer in asyn parameter library? Mark Rivers
- Next:
Re: Store 64-bit integer in asyn parameter library? Luca Cavalli
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
<2018>
2019
2020
2021
2022
2023
2024
|