mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-19 09:34:18 +01:00
fmt inf float str as "Inf"/"-Inf"
This commit is contained in:
@@ -197,6 +197,12 @@ impl Display for OwnedValue {
|
||||
}
|
||||
Self::Float(fl) => {
|
||||
let fl = *fl;
|
||||
if fl == f64::INFINITY {
|
||||
return write!(f, "Inf");
|
||||
}
|
||||
if fl == f64::NEG_INFINITY {
|
||||
return write!(f, "-Inf");
|
||||
}
|
||||
if fl.is_nan() {
|
||||
return write!(f, "");
|
||||
}
|
||||
|
||||
@@ -166,6 +166,14 @@ do_execsql_test select-like-expression {
|
||||
select 2 % 0.5
|
||||
} {}
|
||||
|
||||
do_execsql_test select_positive_infinite_float {
|
||||
SELECT 1.7976931348623157E+308 + 1e308; -- f64::MAX + 1e308
|
||||
} {Inf}
|
||||
|
||||
do_execsql_test select_negative_infinite_float {
|
||||
SELECT -1.7976931348623157E+308 - 1e308 -- f64::MIN - 1e308
|
||||
} {-Inf}
|
||||
|
||||
do_execsql_test select_shl_large_negative_float {
|
||||
SELECT 1 << -1e19;
|
||||
SELECT 1 << -9223372036854775808; -- i64::MIN
|
||||
|
||||
Reference in New Issue
Block a user