split double in c wihout any libary

Posted by DoomStone on Stack Overflow See other posts from Stack Overflow or by DoomStone
Published on 2010-05-08T20:52:13Z Indexed on 2010/05/08 20:58 UTC
Read the original article Hit count: 257

Filed under:
|

Hello I have a question for a c programmer out there, we have a tast at school to create a soft real time system in an operation system made by our teacher. Well that is all fine and dandy, we have chosen to create a system that calcuate how many unites of medicine a diabetic need based on his or hers blood sugar. It does not need to be correct just that we have the idea of a real time system :D But we have hit a little snag our formula for calculating the units of medicine is

[blood sugar] * 1.2

But the only way we can send messages between processes is via a structure that contains 8 longs, but here is where my knowledge of c ends, we need for some way to split this double into 2 longs, example: the whole number in long 0 and the decimals in long 1 and then assemble it on the other side. But I have no idea who to do this, and therefore need a little help. We have tried but we do not have access to c standard libraries

© Stack Overflow or respective owner

Related posts about c

    Related posts about double