Fixed the Natural/Universal real error.

This commit is contained in:
Jonathan Turner 2023-10-25 10:52:17 -04:00
parent f57dadaeac
commit 36fc6963f5
4 changed files with 83 additions and 1 deletions

View File

@ -29,7 +29,7 @@ package body ComplexCalculator is
Result : ComplexNumber;
Bottom : Float; -- improved readability & writability due to it repeating
begin
Bottom := (First.Real ** 2.0) + (Second.Imaginary ** 2.0);
Bottom := (First.Real ** 2) + (Second.Imaginary ** 2);
Result.Real := ((First.Real * Second.Real) + (First.Imaginary * Second.Imaginary)) / Bottom;
Result.Imaginary := ((First.Imaginary * Second.Real) - (First.Real * Second.Imaginary)) / Bottom;

82
complexcalculator.ali Normal file
View File

@ -0,0 +1,82 @@
V "GNAT Lib v2021"
P ZX
RN
RV NO_FLOATING_POINT
RV NO_IO
U complexcalculator%b complexcalculator.adb 67f352b9 NE OO PK
W ada%s ada.ads ada.ali
Z ada.strings.text_buffers%s a-sttebu.adb a-sttebu.ali
W ada.text_io%s a-textio.adb a-textio.ali
U complexcalculator%s complexcalculator.ads 1e56cc72 EE NE OO PK
Z ada.strings.text_buffers%s a-sttebu.adb a-sttebu.ali
D ada.ads 20210520051132 76789da1 ada%s
D a-except.ads 20210520051128 946f3014 ada.exceptions%s
D a-ioexce.ads 20210520051128 e4a01f64 ada.io_exceptions%s
D a-stream.ads 20210520051130 119b8fb3 ada.streams%s
D a-string.ads 20210520051130 90ac6797 ada.strings%s
D a-sttebu.ads 20210520051130 18209c64 ada.strings.text_buffers%s
D a-stuten.ads 20210520051130 808c40ad ada.strings.utf_encoding%s
D a-tags.ads 20210520051130 9eaa38c6 ada.tags%s
D a-textio.ads 20210520051130 aef4d56d ada.text_io%s
D a-unccon.ads 20210520051130 0e9b276f ada.unchecked_conversion%s
D complexcalculator.ads 20231024191420 1e56cc72 complexcalculator%s
D complexcalculator.adb 20231025145030 d7514ba6 complexcalculator%b
D interfac.ads 20210520051132 edec285f interfaces%s
D i-cstrea.ads 20210520051132 e53d8b8e interfaces.c_streams%s
D system.ads 20210520051136 2ffa5114 system%s
D s-crtl.ads 20210520051132 0ebbdb71 system.crtl%s
D s-exctab.ads 20210520051132 54135002 system.exception_table%s
D s-ficobl.ads 20210520051132 078245e4 system.file_control_block%s
D s-parame.ads 20210520051134 4752c4cb system.parameters%s
D s-putima.ads 20210520051134 4e095881 system.put_images%s
D s-secsta.ads 20210520051134 9b3ab94b system.secondary_stack%s
D s-soflin.ads 20210520051134 a7318a92 system.soft_links%s
D s-stache.ads 20210520051134 a37c21ec system.stack_checking%s
D s-stalib.ads 20210520051134 472fbca8 system.standard_library%s
D s-stoele.ads 20210520051134 2dc34a04 system.storage_elements%s
D s-stoele.adb 20210520051134 ed88f8fb system.storage_elements%b
D s-traent.ads 20210520051134 26a8d361 system.traceback_entries%s
D s-unstyp.ads 20210520051134 2b077493 system.unsigned_types%s
D s-wchcon.ads 20210520051136 1b7d22d2 system.wch_con%s
D unchconv.ads 20210520051136 ca2f9e18 unchecked_conversion%s
G a e
G c Z s b [add complexcalculator 11 13 none]
G c Z s b [sub complexcalculator 12 13 none]
G c Z s b [multiply complexcalculator 13 13 none]
G c Z s b [divide complexcalculator 14 13 none]
G c Z s s [complexnumberIP complexcalculator 3 9 none]
X 1 ada.ads
16K9*Ada 20e8 12|1r6
X 9 a-textio.ads
58K13*Text_IO 725e16 12|1w10
X 11 complexcalculator.ads
1K9*ComplexCalculator 16l5 16e22 12|3b14 50l5 50t22
3R9*ComplexNumber 8e14 11r33 11r55 12r33 12r55 13r38 13r60 14r36 14r58 12|6r33
. 6r55 7r16 17r33 17r55 18r16 28r36 28r58 29r16 41r38 41r60 42r16
5f7*Real{float} 12|10m14 10r28 10r42 21m14 21r28 21r42 32r24 34m14 34r30
. 34r44 35r54 35r69 45m14 45r29 45r43 46r34 46r87
6f7*Imaginary{float} 12|11m14 11r33 11r52 22m14 22r33 22r52 32r45 34r59 34r78
. 35m14 35r35 35r83 45r58 45r77 46m14 46r48 46r68
11V13*Add{3R9} 11>17 11>24 12|6b13 14l8 14t11
11r17 First{3R9} 12|6b17 10r22 11r27
11r24 Second{3R9} 12|6b24 10r35 11r45
12V13*Sub{3R9} 12>17 12>24 12|17b13 25l8 25t11
12r17 First{3R9} 12|17b17 21r22 22r27
12r24 Second{3R9} 12|17b24 21r35 22r45
13V13*Multiply{3R9} 13>22 13>29 12|41b13 49l8 49t16
13r22 First{3R9} 12|41b22 45r23 45r52 46r28 46r62
13r29 Second{3R9} 12|41b29 45r36 45r70 46r41 46r80
14V13*Divide{3R9} 14>20 14>27 12|28b13 38l8 38t14
14r20 First{3R9} 12|28b20 32r18 34r24 34r53 35r29 35r63
14r27 Second{3R9} 12|28b27 32r38 34r37 34r71 35r47 35r76
X 12 complexcalculator.adb
7r7 Result{11|3R9} 10m7 11m7 12r14
18r7 Result{11|3R9} 21m7 22m7 23r14
29r7 Result{11|3R9} 34m7 35m7 36r14
30f7 Bottom{float} 32m7 34r92 35r97
42r7 Result{11|3R9} 45m7 46m7 47r14

BIN
complexcalculator.o Normal file

Binary file not shown.

BIN
main.exe Normal file

Binary file not shown.