Skip to content

Commit 7cd4753

Browse files
author
Tim Muehle
committed
Release 1.0.2
- Bugfix für kleine Zahlen in der IEEE-Norm - Fehlermeldung hinzugefügt, wenn der Exponent der IEEE-Norm zu groß oder zu klein ist (beim Umwandeln von dezimal nach IEEE)
1 parent ae74816 commit 7cd4753

13 files changed

+92
-31
lines changed

build_installer_mac.command

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cd "$(dirname "$0")" # zum Pfad dieses Skriptes wechseln
1313
# Mit den folgeneden Variablen koennen die Grundlegenden Daten fuer das Projekt eingestellt werden:
1414
NAME="Bitchanger"
1515
DESCRIPTION="Rechner fuer beliebige Zahlensysteme"
16-
VERSION="1.0.1"
16+
VERSION="1.0.2"
1717
VENDOR="Entwicklungsprojekt_EB2020 by Tim Mühle and Moritz Wolter"
1818
# set COPYRIGHT = ""
1919
# set LICENSE_FILE = ""

build_installer_win.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rem ---- Benoetigte Informationen in Variablen speichern -----------------------
1111
rem Mit den folgeneden Variablen koennen die Grundlegenden Daten fuer das Projekt eingestellt werden:
1212
set NAME=Bitchanger
1313
set DESCRIPTION="Rechner fuer beliebige Zahlensysteme"
14-
if not defined VERSION set VERSION=1.0.1
14+
if not defined VERSION set VERSION=1.0.2
1515
set VENDOR="Entwicklungsprojekt_EB2020 by Tim Mühle and Moritz Wolter"
1616
rem set COPYRIGHT = ""
1717
rem set LICENSE_FILE = ""

build_mvn_and_installer_linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cd "$(dirname "$0")" # zum Pfad dieses Skriptes wechseln
1717
# Mit den folgeneden Variablen koennen die Grundlegenden Daten fuer das Projekt eingestellt werden:
1818
NAME=Bitchanger
1919
DESCRIPTION="Rechner fuer beliebige Zahlensysteme"
20-
VERSION=1.0.1
20+
VERSION=1.0.2
2121
VENDOR="Entwicklungsprojekt_EB2020 by Tim Mühle and Moritz Wolter"
2222
# set COPYRIGHT = ""
2323
# set LICENSE_FILE = ""

build_mvn_and_installer_linux_rpm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cd "$(dirname "$0")" # zum Pfad dieses Skriptes wechseln
1717
# Mit den folgeneden Variablen koennen die Grundlegenden Daten fuer das Projekt eingestellt werden:
1818
NAME=Bitchanger
1919
DESCRIPTION="Rechner fuer beliebige Zahlensysteme"
20-
VERSION=1.0.1
20+
VERSION=1.0.2
2121
VENDOR="Entwicklungsprojekt_EB2020 by Tim Mühle and Moritz Wolter"
2222
# set COPYRIGHT = ""
2323
# set LICENSE_FILE = ""

build_mvn_and_installer_mac.command

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cd "$(dirname "$0")" # zum Pfad dieses Skriptes wechseln
1717
# Mit den folgeneden Variablen koennen die Grundlegenden Daten fuer das Projekt eingestellt werden:
1818
NAME="Bitchanger"
1919
DESCRIPTION="Rechner fuer beliebige Zahlensysteme"
20-
VERSION="1.0.1"
20+
VERSION="1.0.2"
2121
VENDOR="Entwicklungsprojekt_EB2020 by Tim Mühle and Moritz Wolter"
2222
# set COPYRIGHT = ""
2323
# set LICENSE_FILE = ""

build_mvn_and_installer_win.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ rem ---- Benoetigte Informationen in Variablen speichern -----------------------
88
rem Mit den folgeneden Variablen koennen die Grundlegenden Daten fuer das Projekt eingestellt werden:
99
set NAME=Bitchanger
1010
set DESCRIPTION="Rechner fuer beliebige Zahlensysteme"
11-
set VERSION=1.0.1
11+
set VERSION=1.0.2
1212
set VENDOR="Entwicklungsprojekt_EB2020 by Tim Mühle and Moritz Wolter"
1313

1414
set INPUT=installer\source\Windows

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>de.hs-bochum.entwicklungsprojekt_eb2020</groupId>
44
<artifactId>bitchanger</artifactId>
5-
<version>1.0.1</version>
5+
<version>1.0.2</version>
66
<name>Bitchanger</name>
77
<description>Rechner für verschiedene Zahlensysteme</description>
88

src/main/java/bitchanger/calculations/ChangeableNumber.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ public default double asDouble() {
381381
*
382382
* @return IEEE als String-Darstellung dieser {@code ChangeableNumber}
383383
*
384+
* @throws ArithmeticException Wenn diese Zahl nicht in dem IEEE-Standard dargestellt werden kann
385+
*
384386
* @since Bitchanger 0.1.6
385387
*/
386388
/* <!-- $LANGUAGE=EN -->
@@ -390,9 +392,11 @@ public default double asDouble() {
390392
*
391393
* @return IEEE as String representation of this {@code ChangeableNumber}
392394
*
395+
* @throws ArithmeticException if this number cannot be presented by the given ieee standard
396+
*
393397
* @since Bitchanger 0.1.6
394398
*/
395-
public abstract String toIEEEString(IEEEStandard standard);
399+
public abstract String toIEEEString(IEEEStandard standard) throws ArithmeticException;
396400

397401
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
398402

src/main/java/bitchanger/calculations/ConvertingNumbers.java

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package bitchanger.calculations;
1010

1111
import java.util.ArrayList;
12+
import java.util.Locale;
1213
import java.util.Queue;
1314
import java.util.Scanner;
1415

@@ -37,7 +38,7 @@
3738
* @author Moritz Wolter
3839
*
3940
* @since Bitchanger 0.1.0
40-
* @version 1.0.0
41+
* @version 1.0.2
4142
*/
4243
/* <!-- $LANGUAGE=EN -->
4344
* The {@code ConvertingNumbers} class contains methods for performing conversions of numbers with different numeral systems.
@@ -58,7 +59,7 @@
5859
* @author Moritz Wolter
5960
*
6061
* @since Bitchanger 0.1.0
61-
* @version 1.0.0
62+
* @version 1.0.2
6263
*/
6364
public class ConvertingNumbers {
6465

@@ -173,6 +174,32 @@ else if (i == 0 && (character == '+' || character == '-')) {
173174

174175

175176

177+
// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
178+
// # #
179+
// # Umwandeln von dezimal in double #
180+
// # #
181+
// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
182+
183+
184+
// TODO JavaDoc @since 1.0.2
185+
public static String doubleToString(double d) {
186+
StringBuilder decStr = new StringBuilder(String.format(Locale.ENGLISH, "%.324f", d));
187+
while(decStr.charAt(decStr.length() - 1) == '0') {
188+
decStr.deleteCharAt(decStr.length() - 1);
189+
}
190+
191+
if (decStr.charAt(decStr.length() - 1) == '.') {
192+
decStr.append('0');
193+
}
194+
195+
decStr.setCharAt(decStr.indexOf("."), Preferences.getPrefs().getComma());
196+
197+
return decStr.toString();
198+
}
199+
200+
201+
202+
176203
// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
177204
// # #
178205
// # Umwandeln von beliebiger Basis nach dezimal #
@@ -263,6 +290,8 @@ public static String baseToDecString(int base, String value, char comma) throws
263290
* @throws NumberFormatException wenn der Parameter {@code value} keine Zahl zur Basis {@code base} ist
264291
* @throws IllegalArgumentException wenn {@code value} ein leerer String ist oder wenn {@code basis} den Wertebereich [2, 36] verl\u00E4sst &#160; - &#160; <b>see</b> {@link isValueToBase(int base, String value)}
265292
* @throws NumberOverflowException wenn der ganzzahlige Wert von {@code value} gr\u00F6\u00DFer oder kleiner ist als +/- {@link Long#MAX_VALUE}
293+
*
294+
* @version 1.0.2
266295
*/
267296
/* <!-- $LANGUAGE=EN -->
268297
* Converts the submitted number {@code value} of any base {@code base} into a number of the decimal system as string representation.
@@ -277,6 +306,8 @@ public static String baseToDecString(int base, String value, char comma) throws
277306
* @throws NumberFormatException if the parameter {@code value} is not a number of base {@code base}
278307
* @throws IllegalArgumentException if {@code value} is an empty string or {@code basis} leaves the range of value [2, 36] &#160; - &#160; <b>see</b> {@link isValueToBase(int base, String value)}
279308
* @throws NumberOverflowException if integer part of {@code value} is greater or less +/- {@link Long#MAX_VALUE}
309+
*
310+
* @version 1.0.2
280311
*/
281312
public static String baseToDecString(int base, String value, char comma, Queue<ConversionStep> calcPath) throws NullPointerException, NumberFormatException, IllegalArgumentException, NumberOverflowException {
282313
// Prüfen, ob value eine Zahl zur gegebenen Basis repräsentiert
@@ -369,11 +400,12 @@ else if(isNegativeBin) {
369400
integerPart += 1;
370401
}
371402

372-
String integerStr = String.valueOf((long)(integerPart));
403+
String integerStr = String.valueOf((long)integerPart);
373404

374405
if(fractionalPart != 0.0) {
375406
// Rückgabe mit Nachkommateil
376-
String fractionalStr = String.valueOf(fractionalPart).substring(2);
407+
String fractionalStr = doubleToString(fractionalPart).substring(2);
408+
377409
String valueStr = integerStr + comma + fractionalStr;
378410

379411
if(calcPath != null) calcPath.add(new ConversionStep("Beide Teile zusammenf\u00FCgen: " + splitInBlocks(10, integerStr) + " + " + splitInBlocks(10, "0." +fractionalStr) + " = " + splitInBlocks(10, valueStr), true));

src/main/java/bitchanger/calculations/IEEEStandard.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @author Tim M\u00FChle
1515
*
1616
* @since Bitchanger 0.1.7
17-
* @version 1.0.0
17+
* @version 1.0.2
1818
*
1919
*/
2020
public enum IEEEStandard {
@@ -44,6 +44,11 @@ public int getExpLength() {
4444
return this.expLength;
4545
}
4646

47+
// @since Bitchanger 1.0.2
48+
public long maxExp() {
49+
return (long) (Math.pow(2, expLength) - 1);
50+
}
51+
4752
// @since Bitchanger 1.0.0
4853
public int getMantLength() {
4954
return bitLength - expLength - 1;

0 commit comments

Comments
 (0)