From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada 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 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <6488d44e-1ea7-47bc-8d01-ab571677b6a5@googlegroups.com> <6002f2d2-71da-4cc1-aae4-c1de68ef2694@googlegroups.com> <2eaeaeea-0d91-43bf-8da3-1cb6f3c9117b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 1 Dec 2017 16:39:56 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="bb7db6b7e5649449c49eca88698b05bb"; logging-data="14177"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/D9nCaQGOF5qlEOeqYWc8gYrAihD/qVD4=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 In-Reply-To: <2eaeaeea-0d91-43bf-8da3-1cb6f3c9117b@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:V9qNxSMBH9Zz+LTDsyaCYRDKlUI= Xref: reader02.eternal-september.org comp.lang.ada:49306 Date: 2017-12-01T17:39:56+01:00 List-Id: 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