Questions tagged [jscience]

JScience is a comprehensive Java library for scientific computing.

JScience is a comprehensive Java library for scientific computing. It provides strongly typed mathematical and physical structures, as well as efficient integer, rational, real and complex numbers types.

63 questions
153
votes
32 answers

How to convert number to words in java

We currently have a crude mechanism to convert numbers to words (e.g. using a few static arrays) and based on the size of the number translating that into an english text. But we are running into issues for numbers which are huge. 10183 = Ten…
Jason
  • 12,229
  • 20
  • 51
  • 66
14
votes
2 answers

Is there any available API to represent various units of item like KG, Litre, Metre, KM, etc

In my project, somewhere I have to work with a unitOfIssue of Items. Now, various items of course can have different units of representation. So, I was searching for some API or some way, to elegantly handle this situation. Is there any available…
Rohit Jain
  • 209,639
  • 45
  • 409
  • 525
11
votes
3 answers

Which jsr-275 units implementation should be used?

JSR 275 seems to be in a rejected state. JScience seems to have an implementation and there seems to be unitsofmeasure. Are there any other open source implementations? Which package is jsr-275 compliant and easy to use.
Sam
  • 8,387
  • 19
  • 62
  • 97
8
votes
3 answers

How do I make Java format a double like -3.2 rather than -3.1999999999999953?

My app is producing doubles where Double.toString() produces "-3.1999999999999953" - whereas I would expect it to produce "-3.2". I'm actually getting these doubles from JScience's Amount#getEstimatedValue(). I don't want to set an arbitrary number…
sanity
  • 35,347
  • 40
  • 135
  • 226
8
votes
1 answer

Gradle: How to exclude javax.realtime package from JScience jar dependency (Multiple dex define)

I'm using Gradle in my Android application an I would like to use the JScience library dependency. I have added the library this way: dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'org.jscience:jscience:4.3.1' …
yyunikov
  • 5,719
  • 2
  • 43
  • 78
6
votes
4 answers

Java units of measurement library addition and subtraction returning incorrect values

I'm using the reference implementation of JSR363. I've tried many variations of this but I'll give this code as an example. ServiceProvider provider = ServiceProvider.current(); QuantityFactory lengthFactory =…
zjuhasz
  • 1,489
  • 12
  • 30
4
votes
3 answers

Java - JScience define a new unit

I want to define a new distance unit in JScience. The "Tutorial" section of the project website just leads to Javadoc which, while fairly complete, is a bit too dense for me to fathom how I actually go about defining my own unit. Could you provide…
user130076
4
votes
3 answers

JSR 275 - Units, Percent per second

I need to represent the unit of Percent per second using the JScience.org's JSR 275 units and measures implementation. I am trying to do to the following: Unit PERCENT_PER_SECOND =…
I82Much
  • 26,901
  • 13
  • 88
  • 119
3
votes
2 answers

Strong scientific typing in XML and in Java

My project contains a big XSD Schema, and schema instances are binded to the java code using JAXB. I would like to add strong types into the java code, using JScience, and bind them to XSD types. My current problem is that JAXB handle very badly…
cdupont
  • 1,138
  • 10
  • 17
3
votes
0 answers

Are there any concrete usage examples of the Java Units of Measurement API?

I'm using javax.measure:unit-api:1.0, and I can't even find any way to actually instantiate a (number, unit) pair which I thought was the whole point of this API. All the documentation seems to be geared to the development of the library itself and…
zjuhasz
  • 1,489
  • 12
  • 30
3
votes
0 answers

Inverse of a ProductUnit

I am trying to extend the measurements part of jscience with my own units for fuel efficiency. I defined multiple units within the units: FuelEconomy and FuelConsumption. Example of some of the defined values: public static final Unit
3
votes
2 answers

pow for LargeInteger

LargeInteger doesn't seem to have a pow function, or if it does, it cannot process pow(0) though BigInteger can. I have tried to construct my own, but memory seems to spike badly, and there may be an infinite loop as it runs endlessly: public static…
user1382306
3
votes
1 answer

Making a contourplot in Java from large data-arrays

I have the following question: Is there a Tool to make an contureplot in Java during the runtime out of large data arrays? I found many post related to this question (also here contourplot question and another question) but I didn't found any…
Hans Dampf
  • 67
  • 1
  • 9
2
votes
1 answer

Example of JScience 5.0

I'm trying to give JScience-physics 5.0-SNAPSHOT a spin. Unfortunately I can't seem to find the entry into the code. The examples on the JScience website are all for 4.3.1; using the Amount class. From there it's pretty clear how to convert, doing…
Jan Goyvaerts
  • 2,913
  • 4
  • 35
  • 48
2
votes
1 answer

JScience: Create a unit that is defined as a combination of multiple variables

I discovered JScience a couple months ago and it has been a huge help for my project, though I'm struggling with one thing. I'm trying to create a PressureHead (aka water column) unit that can be converted directly with Length and indirectly with…
Pilot_51
  • 7,337
  • 3
  • 29
  • 26
1
2 3 4 5