This brief guide demonstrates how to solve quadratic equations in RhinoScript.

## Problem

If you are trying to solve quadratic equations like:

the results may seem incorrect at times.

## Solution

Most likely, the problem that is that there are floating point rounding errors. Being that you only get 15 decimal places of accuracy, you can use them all up if you are dealing with small numbers.

The following algorithm should produce more accurate results:

Function QuadraticSolver(a, b, c)
Dim d, s0, s1
d = b * b - 4 * a * c
If d < 0 Then
' No real solution
{"ft_lang_label":"__label__en","ft_lang_prob":0.8257731,"math_prob":0.9926475,"size":758,"snap":"2021-31-2021-39","text_gpt3_token_len":216,"char_repetition_ratio":0.108753316,"word_repetition_ratio":0.013986014,"special_character_ratio":0.29419526,"punctuation_ratio":0.0890411,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9899069,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-26T23:05:46Z\",\"WARC-Record-ID\":\"<urn:uuid:9920faaf-1c92-4ea9-9c87-2e9f3651114f>\",\"Content-Length\":\"16508\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f4738c2b-70c9-4771-aaa1-32d126193014>\",\"WARC-Concurrent-To\":\"<urn:uuid:4a928166-793e-4f43-9885-ec76bbda8352>\",\"WARC-IP-Address\":\"185.199.109.153\",\"WARC-Target-URI\":\"https://developer.rhino3d.com/5/guides/rhinoscript/quadratic-solver/\",\"WARC-Payload-Digest\":\"sha1:UNTC5Q6MRTVBEW4YU6YJFOF4ZY3FXG6T\",\"WARC-Block-Digest\":\"sha1:GVKN3YEBZQOOSB6KGKA74VYDBJGEZ2MZ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780057973.90_warc_CC-MAIN-20210926205414-20210926235414-00212.warc.gz\"}"}