Skip to content
Snippets Groups Projects
Commit 994f62af authored by Julien Lopez's avatar Julien Lopez
Browse files

Fixes in tests and translation for double type

parent bd1d2703
No related branches found
No related tags found
No related merge requests found
......@@ -213,11 +213,8 @@ public final class QIRInterface {
return new QIRNumber(src, (Long) value);
if (value instanceof Byte)
return new QIRNumber(src, (Byte) value);
if (value instanceof Double) {
if ((double) value == Math.floor((double) value))
return new QIRNumber(src, ((Double) value).longValue());
if (value instanceof Double)
return new QIRDouble(src, (Double) value);
}
if (value instanceof Boolean)
return QIRBoolean.create((Boolean) value);
if (value instanceof String)
......
dol_to_euro = function (dol) dol * 89 / 100
dol_to_euro = function (dol) dol * 89.0 / 100.0
emp = new.tableRef("emp", "PostgreSQL", "postgre.config", "public")
minsalary = 2500
minsalary = 2500.0
q = select(function (x) {
res = new.env()
res$empno = x$empno
......
dol_to_euro = function (dol) dol * 89 / 100
dol_to_euro = function (dol) dol * 89.0 / 100.0
dol_to_euro2 = dol_to_euro
emp = new.tableRef("emp", "PostgreSQL", "postgre.config", "public")
minsalary = 2500
minsalary = 2500.0
q = select(function (x) {
res = new.env()
res$empno = x$empno
......
emp = new.tableRef("emp", "PostgreSQL", "postgre.config", "public")
minsalary = 2500
minsalary = 2500.0
q = select(function (x) {
res = new.env()
res$empno = x$empno
res$ename = x$ename
res$salary = (function (dol) dol * 89 / 100)(x$sal)
res$salary = (function (dol) dol * 89.0 / 100.0)(x$sal)
res },
where(function (x) x$sal >= minsalary,
from(emp)))
......
......@@ -4,7 +4,7 @@ getRate = function(rfrom, rto)
change = new.tableRef("change", "PostgreSQL", "postgre.config", "public")
rate = query.force(where(function (r) r$cfrom == rfrom && r$cto == rto,
from(change)))
if (rfrom == rto) 1 else rate$change
if (rfrom == rto) 1.0 else rate$change
}
# Returns the names of employees earning at least minSalary in the curr
......@@ -19,7 +19,7 @@ atLeast = function(minSalary, curr)
from(emp)))
}
richUSPeople = atLeast(2000, "USD")
richEURPeople = atLeast(2000, "EUR")
richUSPeople = atLeast(2000.0, "USD")
richEURPeople = atLeast(2000.0, "EUR")
print(query.force(richUSPeople))
print(query.force(richEURPeople))
emp = new.tableRef("emp", "PostgreSQL", "postgre.config", "public")
minsalary = 2500
minsalary = 2500.0
q = select(function (x) {
res = new.env()
res$empno = x$empno
res$ename = x$ename
res$salary = function (dol){
a = dol * 89 / 100
while (a > 1000) a = a * 89 / 100
a = dol * 89.0 / 100.0
while (a > 1000.0) a = a * 89.0 / 100.0
a
}(x$sal)
res },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment