We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String interpolation of float precision( %g) should consist to it's C version.
A format.v
module main fn main() { a := 31.2400e+200 println('31.2400e+200 8.0g[${a:8.0g}]') println('31.2400e+200 8.1g[${a:8.1g}]') println('31.2400e+200 8.2g[${a:8.2g}]') println('31.2400e+200 8.3g[${a:8.3g}]') println('31.2400e+200 8.4g[${a:8.4g}]') }
result is :
31.2400e+200 8.0g[ ] 31.2400e+200 8.1g[3.1e+201] 31.2400e+200 8.2g[3.12e+201] 31.2400e+200 8.3g[3.124e+201] 31.2400e+200 8.4g[3.124e+201]
A format.c
#include <stdio.h> void main() { double c = 31.2400e+200; printf("31.2400e+200 8.0g[%8.0g]\n",c); printf("31.2400e+200 8.1g[%8.1g]\n",c); printf("31.2400e+200 8.2g[%8.2g]\n",c); printf("31.2400e+200 8.3g[%8.3g]\n",c); printf("31.2400e+200 8.4g[%8.4g]\n",c); }
31.2400e+200 8.0g[ 3e+201] 31.2400e+200 8.1g[ 3e+201] 31.2400e+200 8.2g[3.1e+201] 31.2400e+200 8.3g[3.12e+201] 31.2400e+200 8.4g[3.124e+201]
V version will generate same result to it's C version
They are different.
format process has some bug?
No response
V full version: V 0.4.8 7b8e059.0390c07
V full version: V 0.4.8 7b8e059.0390c07 OS: linux, Ubuntu 24.04.1 LTS Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
getwd: /home/mars/v/format vexe: /media/HD/github/kbkpbot/v/v vexe mtime: 2024-10-04 14:33:40
vroot: OK, value: /media/HD/github/kbkpbot/v VMODULES: OK, value: /home/mars/.vmodules VTMP: OK, value: /tmp/v_1000
Git version: git version 2.43.0 Git vroot status: 0.4.8-42-g0a997d90 (3 commit(s) behind V master) .git/config present: true
CC version: cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0 thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered:
ss.v
fn main() { a := 1234.5600e+100 println('1234.5600e+100 8.3g[${a:8.3g}]') }
create a wrong result:
1234.5600e+100 8.3g[0.1235e+104]
This should be :
1234.5600e+100 8.3g[1.23e+103]
Sorry, something went wrong.
309c8d3
No branches or pull requests
Describe the bug
String interpolation of float precision( %g) should consist to it's C version.
Reproduction Steps
A format.v
result is :
A format.c
result is :
Expected Behavior
V version will generate same result to it's C version
Current Behavior
They are different.
Possible Solution
format process has some bug?
Additional Information/Context
No response
V version
V full version: V 0.4.8 7b8e059.0390c07
Environment details (OS name and version, etc.)
V full version: V 0.4.8 7b8e059.0390c07
OS: linux, Ubuntu 24.04.1 LTS
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
getwd: /home/mars/v/format
vexe: /media/HD/github/kbkpbot/v/v
vexe mtime: 2024-10-04 14:33:40
vroot: OK, value: /media/HD/github/kbkpbot/v
VMODULES: OK, value: /home/mars/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.43.0
Git vroot status: 0.4.8-42-g0a997d90 (3 commit(s) behind V master)
.git/config present: true
CC version: cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: