comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Converting 64 bit float to record containing a record of one 32 bit integer and one 32 unsigned.
Date: Fri, 1 Dec 2017 17:39:56 +0100
Date: 2017-12-01T17:39:56+01:00	[thread overview]
Message-ID: <ovs0ks$dr1$1@dont-email.me> (raw)
In-Reply-To: <2eaeaeea-0d91-43bf-8da3-1cb6f3c9117b@googlegroups.com>

On 12/01/2017 01:32 PM, Petter Fryklund wrote:
> 
> Well since not in academia, I must solve the problems at hand, not invent new ones ;-) This solves the problem of storing a 64 bit value received from outside in a float value containing seconds since Jan 1st 1970. Old ObjectAda doesn't have 64 bit integers. Going via a hex value made the last part, storing the Integer value in the most significant part and the Natural value in the least significantpart, easy.

It's not inventing new problems, it's designing something you need in a general, 
reusable way. Reinventing yet again the algorithm to convert a numeric value to 
an image rather than making use of existing facilities to accomplish the same end.

If you can find the quotient and remainder of dividing by 16, couldn't you do 
the same thing with 2 ** 32? Wouldn't the resulting values be directly 
convertible to your integer types?

-- 
Jeff Carter
"We call your door-opening request a silly thing."
Monty Python & the Holy Grail
17


  reply	other threads:[~2017-12-01 16:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01  6:38 Converting 64 bit float to record containing a record of one 32 bit integer and one 32 unsigned Petter Fryklund
2017-12-01  9:24 ` Petter Fryklund
2017-12-01 11:33   ` Jeffrey R. Carter
2017-12-01 12:32     ` Petter Fryklund
2017-12-01 16:39       ` Jeffrey R. Carter [this message]
2017-12-05  7:55         ` Petter Fryklund
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox