comp.lang.ada
 help / color / mirror / Atom feed
* Noob question..  Autopromotion?
@ 2014-05-05 14:22 sdalemorrey
  2014-05-05 14:54 ` Adam Beneschan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: sdalemorrey @ 2014-05-05 14:22 UTC (permalink / 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!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-07 16:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-05 14:22 Noob question.. Autopromotion? sdalemorrey
2014-05-05 14:54 ` 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

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