[jOOQ/jOOQ#10880] Firebird may also produce -NaN values

This commit is contained in:
Lukas Eder 2024-08-19 09:06:32 +02:00
parent 79e60a7369
commit 1c453a1e28
2 changed files with 9 additions and 2 deletions

View File

@ -219,6 +219,7 @@ public final class Decfloat extends Number implements Data {
switch (lc = data.toLowerCase()) {
case "+nan":
case "nan":
case "-nan":
special = Special.NAN;
break;

View File

@ -2946,7 +2946,10 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
static final Field<?> nan(BindingSQLContext<?> ctx, DataType<?> type) {
switch (ctx.family()) {
case FIREBIRD:
return log(inline(1), inline(1));
if (type.isDecimal())
return inline("NaN").cast(type);
else
return log(inline(1), inline(1));
case HSQLDB:
return inline(0.0).div(field("0.0e0", (DataType) type));
default:
@ -2958,7 +2961,10 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
static final Field<?> infinity(BindingSQLContext<?> ctx, DataType<?> type, boolean negative) {
switch (ctx.family()) {
case FIREBIRD:
return log(negative ? inline(0.5) : inline(1.5), inline(1));
if (type.isDecimal())
return inline(negative ? "-Infinity" : "Infinity").cast(type);
else
return log(negative ? inline(0.5) : inline(1.5), inline(1));
case HSQLDB:
return inline(negative ? -1.0 : 1.0).div(field("0.0e0", (DataType) type));
default: