| 1 |
# 2026-02-20 |
| 2 |
# |
| 3 |
# The author disclaims copyright to this source code. In place of |
| 4 |
# a legal notice, here is a blessing: |
| 5 |
# |
| 6 |
# May you do good and not evil. |
| 7 |
# May you find forgiveness for yourself and forgive others. |
| 8 |
# May you share freely, never taking more than you give. |
| 9 |
# |
| 10 |
#*********************************************************************** |
| 11 |
# |
| 12 |
# Tests of the sqlite3AtoF() function. |
| 13 |
# |
| 14 |
|
| 15 |
set testdir [file dirname $argv0] |
| 16 |
source $testdir/tester.tcl |
| 17 |
|
| 18 |
# Rounding cases: |
| 19 |
# |
| 20 |
do_execsql_test atof2-1.0 { |
| 21 |
SELECT format('%g',192.496475); |
| 22 |
} 192.496 |
| 23 |
do_execsql_test atof2-1.1 { |
| 24 |
SELECT format('%g',192.496501); |
| 25 |
} 192.497 |
| 26 |
|
| 27 |
load_static_extension db ieee754 |
| 28 |
do_execsql_test atof2-2.1 { |
| 29 |
SELECT format('%!.30f',ieee754_inc(100.0,-1)); |
| 30 |
} 99.9999999999999858 |
| 31 |
do_execsql_test atof2-2.2 { |
| 32 |
SELECT format('%!.30f',ieee754_inc(100.0,-2)); |
| 33 |
} 99.9999999999999716 |
| 34 |
|
| 35 |
finish_test |