Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Ada Dimentional System
with System.Dim.Float_IO; procedure Main is type currency is new Float with Dimension_System => ( (Unit_Name => Dollor, Unit_Symbol => "$", Dim_Symbol => "USD"), (Unit_Name => Pound, Unit_Symbol => "£", Dim_Symbol => "GBP") ); subtype usd is currency with Dimension => (Symbol => "$", Dollor => 1, Pound => 0); subtype gbp is currency with Dimension => (Symbol => "£", Pound => 1, Dollor => 0); subtype gpb_by_usb_rate is currency with Dimension => (Symbol => "£/$", Pound => 1, Dollor => -1); subtype usd_by_gbp_rate is currency with Dimension => (Symbol => "$/£", Dollor => 1, Pound => -1); d : usd := 1.0; p : gbp := 1.0 ; d_p : usd_by_gbp_rate := 0.8; p_d : gpb_by_usb_rate := 0.2; package currency_io is new System.Dim.Float_IO(currency); begin p := d * p_d; currency_io.Put(p, exp=>0); end Main;
run
|
edit
|
history
|
help
0
Controlled types (temporary anonymous objects)
1d array as 4d with easy reshaping
ordenar.adb
plop
Dynamic Dispatching with no dynamic allocation
Overloaded Ada
division_emtera_p.adb
macro-like function
Dynamic Dispatching with dynamic allocation
Memory Alignment