comp.lang.ada
 help / color / mirror / Atom feed
From: sdalemorrey@gmail.com
Subject: Noob question..  Autopromotion?
Date: Mon, 5 May 2014 07:22:43 -0700 (PDT)
Date: 2014-05-05T07:22:43-07:00	[thread overview]
Message-ID: <9ac10bab-2ade-4ac8-a99b-336595e38f67@googlegroups.com> (raw)

Hello,

I've been reading this...

www.adacore.com/uploads_gems/Ada_for_the_C++_or_Java_Developer-cc.pdf

On page 14 it says...

"In Ada, a floating point literal must be written with both an integral and decimal part.  10 is not a valid literal for a floating point value, while 10.0 is."

In my use case I will have users entering values (likely to be whole integers) and these will be multiplied by the price.

For example...

Buy 100 USD @ 1.1 CAD

However there is also the market order where the person will be buying or selling at best available price and then we have to report the average price paid.

110 CAD / 100 USD

So the question is, if I use some sort of floating point type for all 3 values, what's going to happen during assignment?  I can't necessarily check user input ahead of time and force them to input 100.00, so is there a way to autopromote the values? Thanks!


             reply	other threads:[~2014-05-05 14:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-05 14:22 sdalemorrey [this message]
2014-05-05 14:54 ` Noob question.. Autopromotion? Adam Beneschan
2014-05-05 15:32 ` Nasser M. Abbasi
2014-05-05 19:30   ` Simon Wright
2014-05-06 13:31 ` gautier_niouzes
2014-05-07 16:13   ` jpwoodruff
replies disabled

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